[PATCH] D84559: [compiler-rt][cmake] Don't pass --version-script to Illumos ld

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 04:04:56 PDT 2020


ro added a subscriber: MaskRay.
ro added a comment.

In D84559#2180630 <https://reviews.llvm.org/D84559#2180630>, @aeubanks wrote:

> I'm seeing
> ld.lld: error: unknown -z value: gnu-version-script-compat
> for a build with -DLLVM_ENABLE_LLD=On

So far I cannot reproduce this: in a build with `-DLLVM_ENABLE_LLD=On` and clang-10 as the build compiler, `COMPILER_RT_HAS_VERSION_SCRIPT` is `1` in `CMakeCache.txt` while `COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT` is
empty, just as expected.

> /usr/bin/ld: warning: -z gnu-version-script-compat ignored
> in a build without one.

While ugly, this one is expected. I consider `gld` no-so-silently accepting unknown `-z` options a serious bug: it has no way of knowing if the
unknown option is crucial to the link or can be ignored without causing harm.  However, this seems to date back to binutils 2.22 from 2011,
so is unlikely to change.

> $ ninja lib/clang/12.0.0/lib/linux/libclang_rt.ubsan_standalone-i386.so

Works for me just fine.  I even tried a 2-stage build with `-DLLVM_ENABLE_LLD=On` in `CLANG_BOOTSTRAP_PASSTHROUGH`, but that
consistently fails during the stage 2 `cmake` run:

  CMake Error at cmake/modules/HandleLLVMOptions.cmake:277 (message):
    Host compiler does not support '-fuse-ld=lld'

The stage 2 `CMakeFiles/CMakeError.log` has

  Performing C++ SOURCE FILE Test CXX_SUPPORTS_CUSTOM_LINKER failed with the following output:
  Change Dir: /var/llvm/local-x86_64-release-stage2-lld/tools/clang/stage2-bins/CMakeFiles/CMakeTmp
  
  Run Build Command(s):/usr/bin/ninja-build cmTC_1d566 && [1/2] Building CXX object CMakeFiles/cmTC_1d566.dir/src.cxx.o
  clang-12: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
  [2/2] Linking CXX executable cmTC_1d566
  FAILED: cmTC_1d566
  : && /var/llvm/local-x86_64-release-stage2-lld/./bin/clang++  -DCXX_SUPPORTS_CUSTOM_LINKER  -Werror=unguarded-availability-new -fuse-ld=lld   CMakeFiles/cmTC_1d566.dir/src.cxx.o  -o cmTC_1d566  -lm && :
  clang-12: error: invalid linker name in argument '-fuse-ld=lld'
  ninja: build stopped: subcommand failed.

which is really weird given that the same command works just fine if repeated manually.  This might be related to @MaskRay 's recent
`-fuse-ld` changes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84559/new/

https://reviews.llvm.org/D84559



More information about the llvm-commits mailing list