[PATCH] D43168: Don't use -ldl on BSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 10:40:20 PST 2018


dim added a comment.

In https://reviews.llvm.org/D43168#1005331, @MatzeB wrote:

> @asbirlea: Why is `-dl` and `-pthread` needed at all? Glancing at the code I don't see any reference to pthreads or dlopen/dlsym...


Hmm that is a good one, indeed! I have locally tried deleting the blocks that add -lpthread and -ldl, and at least on Linux, the programs in question all appear to link just fine.

On FreeBSD, I do get errors about pthread functions, though:

  [789/4485] Linking CXX executable Bitcode/Benchmarks/Halide/bilateral_grid/halide_bilateral_grid
  FAILED: Bitcode/Benchmarks/Halide/bilateral_grid/halide_bilateral_grid
  : && /home/dim/obj/test-suite/build/tools/timeit --summary Bitcode/Benchmarks/Halide/bilateral_grid/halide_bilateral_grid.link.time /share/dim/llvm/324090-rel60-freebsd12-amd64-ninja-rel-1/bin/clang++  -O3 -DNDEBUG   Bitcode/Benchmarks/Halide/bilateral_grid/CMakeFiles/halide_bilateral_grid.dir/driver.cpp.o Bitcode/Benchmarks/Halide/bilateral_grid/CMakeFiles/halide_bilateral_grid.dir/__/common/x86_halide_runtime.bc.o Bitcode/Benchmarks/Halide/bilateral_grid/CMakeFiles/halide_bilateral_grid.dir/bilateral_grid.bc.o  -o Bitcode/Benchmarks/Halide/bilateral_grid/halide_bilateral_grid   && :
  Bitcode/Benchmarks/Halide/bilateral_grid/CMakeFiles/halide_bilateral_grid.dir/__/common/x86_halide_runtime.bc.o: In function `halide_spawn_thread':
  posix_allocator.cpp:(.text+0x3ab): undefined reference to `pthread_create'
  clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
  [790/4485] Linking CXX executable Bitcode/Regression/vector_widen/widen_bug
  FAILED: Bitcode/Regression/vector_widen/widen_bug
  : && /home/dim/obj/test-suite/build/tools/timeit --summary Bitcode/Regression/vector_widen/widen_bug.link.time /share/dim/llvm/324090-rel60-freebsd12-amd64-ninja-rel-1/bin/clang++  -O3 -DNDEBUG   Bitcode/Regression/vector_widen/CMakeFiles/widen_bug.dir/driver.cpp.o Bitcode/Regression/vector_widen/CMakeFiles/widen_bug.dir/halide_runtime.bc.o Bitcode/Regression/vector_widen/CMakeFiles/widen_bug.dir/vector_widen.bc.o  -o Bitcode/Regression/vector_widen/widen_bug   && :
  Bitcode/Regression/vector_widen/CMakeFiles/widen_bug.dir/halide_runtime.bc.o: In function `Halide::Runtime::Internal::default_do_par_for(void*, int (*)(void*, int, unsigned char*), int, int, unsigned char*)':
  simd_op_check_runtime.ll:(.text+0x1dd): undefined reference to `pthread_create'
  Bitcode/Regression/vector_widen/CMakeFiles/widen_bug.dir/halide_runtime.bc.o: In function `halide_spawn_thread':
  simd_op_check_runtime.ll:(.text+0x651): undefined reference to `pthread_create'
  clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
  [794/4485] Building CXX object Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o
  ninja: build stopped: subcommand failed.

Apparently there is a `halide_spawn_thread` function in the bitcode.  I am unsure if there is any source for that bitcode?


Repository:
  rL LLVM

https://reviews.llvm.org/D43168





More information about the llvm-commits mailing list