-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
llvmPackages_{20,21,git}.compiler-rt: no fmv on aarch64 without libc #409265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Upstream? |
Already tried going upstream but the PR was closed llvm/llvm-project#125922 |
Hmm, unfortunate… @Ericson2314 what do you think about applying this? Seems a real shame to be adding a new LLVM patch. |
@Ericson2314 just published a blog post adjacent to this: https://blog.obsidian.systems/compiler-bootstrapping-in-nixpkgs/ As patch author, my opinion is that given the timescales involved for a proper fix (e.g. llvm/llvm-project#127227), it would be good to unbreak this today in nixpkgs. |
Wrong issue linked? |
Right issue number, wrong repo. Fixed. |
Can we make the patch less linux-specific? Conceptually, we're talking about about generally building a "freestanding" compiler-rt on a non-freestanding platform, of which Linux is merely one example. |
It looks like setting |
8e018d7
to
31c3a2e
Compare
31c3a2e
to
3bbd5e0
Compare
The commit message and conditioning aren't quite right. We want FMV (Function MultiVersioning) to work on aarch64. Where it doesn't work is in the no-libc compiler-rt, where linux features are unavailable. The original patch meant that the linux build of compiler-rt does have FMV switched on; only if For a bit of background, FMV is machinery which enables having multiple versions of functions targeting different architectural features, and to have the best version selected at runtime. But to do this it needs libc available so it can interrogate the kernel to discover which features are available. The problem is that we're trying to build a compiler-rt without libc available, so we need to condition on this -- it should only apply for |
(Also btw @RossComputerGuy, we'll need to introduce a second GCC NG libgcc build to match LLVM for similar reasons.) |
aarch64 FMV (Function MultiVersioning) is not available before the libc is available. This causes issues while building with compiler-rt on aarch64. By disabling FMV before the libc is available resolves missing symbol errors.
3bbd5e0
to
11fa178
Compare
@peterwaller-arm Thanks for the explanation, I've updated things and this should be gtg now. |
@@ -244,6 +244,10 @@ stdenv.mkDerivation (finalAttrs: { | |||
++ lib.optionals (noSanitizers && lib.versionAtLeast release_version "19") [ | |||
(lib.cmakeBool "COMPILER_RT_BUILD_CTX_PROFILE" false) | |||
] | |||
++ | |||
lib.optional (useLLVM && stdenv.hostPlatform.isAarch64 && !haveLibc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the explanation in the commit message, wouldn't this also be required for !useLLVM
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because the error only pops ups with pkgsLLVM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how does it work in the non-pkgsLLVM case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that it's using something from GCC so the symbol isn't missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterwaller-arm do you know?
…patch
Things done
Fixes #393603
Reverts #380213
Required for #407738
We're sending this patch to master and backporting it so
pkgsLLVM
actually works correctly with LLVM 20 and git.nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.