[llvm] [llvm] Disable HandleLLVMOptions in runtimes mode (PR #73031)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 03:27:17 PST 2023


zmodem wrote:

Here's a reproducer for Chromium's problem. On Linux, at ee922e6ebfb6aab722f6b0f7cfc0c20af636a250, in a build directory under llvm-project, e.g. `llvm-projects/build/`:

```
$ curl -LO https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/0e28d9832614729bb5b731161ff96cb4d516f345/debian_bullseye_arm64_sysroot.tar.xz
$ mkdir sysroot
$ tar -C sysroot -Jxf debian_bullseye_arm64_sysroot.tar.xz
$ curl -LO https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-llvmorg-17-init-16420-g0c545a44-1.tar.xz
$ mkdir bootstrap
$ tar -C bootstrap -Jxf clang-llvmorg-17-init-16420-g0c545a44-1.tar.xz
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON "-DLLVM_ENABLE_PROJECTS=clang;lld" -DLLVM_ENABLE_RUNTIMES=compiler-rt "-DLLVM_TARGETS_TO_BUILD=AArch64;X86" -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_ENABLE_LLD=ON -DCMAKE_C_COMPILER=$PWD/bootstrap/bin/clang -DCMAKE_CXX_COMPILER=$PWD/bootstrap/bin/clang++ -DRUNTIMES_aarch64-unknown-linux-gnu_CMAKE_SYSROOT=$PWD/sysroot -DBUILTINS_aarch64-unknown-linux-gnu_CMAKE_SYSROOT=$PWD/sysroot -DRUNTIMES_aarch64-unknown-linux-gnu_LLVM_INCLUDE_TESTS=OFF -DBUILTINS_aarch64-unknown-linux-gnu_LLVM_INCLUDE_TESTS=OFF -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_CRT=ON -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER=OFF -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF=OFF -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_ORC=OFF -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE=ON -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS=ON -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY=OFF "-DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_SANITIZERS_TO_BUILD=asan;dfsan;msan;hwasan;tsan;cfi" -DRUNTIMES_aarch64-unknown-linux-gnu_COMPILER_RT_DEFAULT_TARGET_ONLY=ON "-DLLVM_BUILTIN_TARGETS=aarch64-unknown-linux-gnu" "-DLLVM_RUNTIME_TARGETS=aarch64-unknown-linux-gnu" ../llvm
$ ninja runtimes-aarch64-unknown-linux-gnu-build
...
FAILED: /work/llvm-project/build.nanana/lib/clang/18/lib/aarch64-unknown-linux-gnu/libclang_rt.hwasan.so 
...
/usr/bin/ld: unrecognised emulation mode: aarch64linux
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386pep i386pe
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```


I think the clue is in the last line: `/usr/bin/ld`. It's supposed to be using lld, but probably `-DLLVM_ENABLE_LLD=ON` isn't getting forwarded to the runtimes build as it was before.

https://github.com/llvm/llvm-project/pull/73031


More information about the llvm-commits mailing list