diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index a40ffd4044b4..3b657ce5bb3f 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -1221,10 +1221,16 @@ let // lib.optionalAttrs (lib.versionAtLeast metadata.release_version "20") { libc-overlay = callPackage ./libc { isFullBuild = false; + # Use clang due to "gnu::naked" not working on aarch64. + # Issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882 + stdenv = overrideCC stdenv buildLlvmTools.clang; }; libc-full = callPackage ./libc { isFullBuild = true; + # Use clang due to "gnu::naked" not working on aarch64. + # Issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882 + stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcNoRt; }; libc = if stdenv.targetPlatform.libc == "llvm" then libraries.libc-full else libraries.libc-overlay; diff --git a/pkgs/development/compilers/llvm/common/libc/default.nix b/pkgs/development/compilers/llvm/common/libc/default.nix index 09fbeb5e7cc6..900c884c72b4 100644 --- a/pkgs/development/compilers/llvm/common/libc/default.nix +++ b/pkgs/development/compilers/llvm/common/libc/default.nix @@ -14,6 +14,7 @@ ninja, isFullBuild ? true, linuxHeaders, + fetchpatch, }: let pname = "libc"; @@ -25,26 +26,28 @@ let cp -r ${monorepoSrc}/llvm "$out" cp -r ${monorepoSrc}/${pname} "$out" ''); - - stdenv' = - if stdenv.cc.isClang then - stdenv.override { - cc = stdenv.cc.override { - nixSupport = stdenv.cc.nixSupport // { - cc-cflags = lib.remove "-lunwind" (stdenv.cc.nixSupport.cc-cflags or [ ]); - }; - }; - } - else - stdenv; in -stdenv'.mkDerivation (finalAttrs: { - inherit pname version patches; +stdenv.mkDerivation (finalAttrs: { + inherit pname version; src = src'; sourceRoot = "${finalAttrs.src.name}/runtimes"; + patches = + lib.optional (lib.versions.major version == "20") + # Removes invalid token from the LLVM version being placed in the namespace. + # Can be removed when LLVM 20 bumps to rc2. + # PR: https://github.com/llvm/llvm-project/pull/126284 + ( + fetchpatch { + url = "https://github.com/llvm/llvm-project/commit/3a3a3230d171e11842a9940b6da0f72022b1c5b3.patch"; + stripLen = 1; + hash = "sha256-QiU1cWp+027ZZNVdvfGVwbIoRd9jqtSbftGsmaW1gig="; + } + ) + ++ patches; + nativeBuildInputs = [ cmake