Rather than invoking the linker directly, let the compiler driver
handle it. This ensures that we use the correct linker in the case
of cross-compiling.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/fuzzer/CMakeLists.txt | ||
---|---|---|
149 |
When you ensured you were using the correct linker by setting CMAKE_LINKER to lld, ironically, this breaks your setup because now CMAKE_CXX_COMPILER is using plain ld, which isn't the correct linker. |
compiler-rt/lib/fuzzer/CMakeLists.txt | ||
---|---|---|
149 | Which linker is going to be used depends on the target and your build configuration (that is the value of CLANG_DEFAULT_LINKER). Furthermore, we shouldn't be relying on any LLD-specific feature here so even BFD ld or gold should work fine. |
compiler-rt/lib/fuzzer/CMakeLists.txt | ||
---|---|---|
149 | Not when BFD ld doesn't support the target. In my case, I'm also setting various CMAKE_*_LINKER_FLAGS to include -fuse-ld=lld, but obviously, that doesn't end up here. | |
149 |
More precisely, when the BFD ld you have available doesn't have the support for the target compiled in. |
When you ensured you were using the correct linker by setting CMAKE_LINKER to lld, ironically, this breaks your setup because now CMAKE_CXX_COMPILER is using plain ld, which isn't the correct linker.