Skip to content

Comments

llvmPackages_{12,13,14,15,16,17,git}.libcxx: add LIBCXXABI_COMPILER_RT flag#297650

Merged
1 commit merged intomasterfrom
unknown repository
Mar 21, 2024
Merged

llvmPackages_{12,13,14,15,16,17,git}.libcxx: add LIBCXXABI_COMPILER_RT flag#297650
1 commit merged intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Mar 21, 2024

Description of changes

fix for aarch64-linux pkgLLVM.libcxx
https://hydra.nixos.org/build/253162977

when building pkgsLLVM.stdenv on aarch64-linux the build fails when building libcxxabi due to the undefined symbols

                 U __aarch64_ldadd4_acq_rel
                 U __aarch64_ldadd8_acq_rel
                 U __aarch64_swp8_acq_rel

setting the cmake flag LIBCXXABI_COMPILER_RT=ON adds compiler-rt to the link step. note that for libcxx we already set the flag LIBCXX_COMPILER_RT=ON.

https://clang.llvm.org/docs/Toolchain.html#compiler-rt-llvm

change #292043 merged libcxx and libcxxabi builds and thus libcxxabi is now getting compiled with the -rtlib=compiler-rt flag. This flag uses the clang runtime functions and thus needs to link with the their implementation, which is what LIBCXXABI_COMPILER_RT=ON does. when compiled without -rtlib=compiler-rt on aarch64 it seems that clang just inlines the implementation so no function call is required. When compiler-rt libraries are available the optimizer decides that a function call is preferable to inlining.

testing:

for x in {12..17} git; nix-build -A pkgsCross.aarch64-multiplatform.pkgsLLVM.llvmPackages_$x.libcxx

llvm14 fails building libunwind, which is a per-existing issue.
llvmgit fails while building compiler-rt

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Mar 21, 2024
…ER_RT=ON

since #292043 libcxxabi is built
using the same compiler wrapper as libcxx and thus uses the
`-rtlib=compiler-rt`. Adding the `LIBCXXABI_USE_COMPILER_RT=ON` at build
time ensures that the compiler-rt libraries provided at link time
resolving symbol errors for aarch64 pkgLLVM.libcxx build

https://hydra.nixos.org/build/253162977
@ghost ghost marked this pull request as ready for review March 21, 2024 09:18
@ghost ghost requested a review from RaitoBezarius as a code owner March 21, 2024 09:18
@ghost ghost merged commit 9ad9869 into NixOS:master Mar 21, 2024
@ghost ghost deleted the libcxxabi_use_compiler_rt branch March 21, 2024 12:06
@ghost ghost mentioned this pull request Mar 22, 2024
15 tasks
@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant