Merge pull request #230470 from amjoseph-nixpkgs/fix/221891

cc-wrapper: when merging gcc32 and gcc64, merge libgcc as well
This commit is contained in:
Adam Joseph 2023-05-09 07:58:12 +00:00 committed by GitHub
commit c74b0ecea5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 7 deletions

View file

@ -364,9 +364,9 @@ stdenv.mkDerivation {
'' ''
# this ensures that when clang passes -lgcc_s to lld (as it does # this ensures that when clang passes -lgcc_s to lld (as it does
# when building e.g. firefox), lld is able to find libgcc_s.so # when building e.g. firefox), lld is able to find libgcc_s.so
+ lib.optionalString (gccForLibs?libgcc) '' + concatMapStrings (libgcc: ''
echo "-L${gccForLibs.libgcc}/lib" >> $out/nix-support/cc-ldflags echo "-L${libgcc}/lib" >> $out/nix-support/cc-ldflags
'') '') (lib.toList (gccForLibs.libgcc or [])))
## ##
## General libc support ## General libc support

View file

@ -28,7 +28,9 @@ let
# includes # includes
ln -s ${glibc_multi.dev}/include $out/ mkdir -p $out/include
ln -s ${glibc_multi.dev}/include/* $out/include
ln -s ${gcc64.cc}/include/c++ $out/include/c++
# dynamic linkers # dynamic linkers
mkdir -p $out/lib/32 mkdir -p $out/lib/32
@ -46,7 +48,13 @@ let
libc = gcc_multi_sysroot; libc = gcc_multi_sysroot;
}; };
gccForLibs = gcc_multi_sysroot; gccForLibs = gcc_multi_sysroot // {
inherit (glibc_multi) libgcc;
langCC =
assert (gcc64.cc.langCC != gcc32.cc.langCC)
-> throw "(gcc64.cc.langCC=${gcc64.cc.langCC}) != (gcc32.cc.langCC=${gcc32.cc.langCC})";
gcc64.cc.langCC;
};
}; };
in clangMulti in clangMulti

View file

@ -1,4 +1,5 @@
{ runCommand, glibc, glibc32 { lib
, runCommand, glibc, glibc32
}: }:
let let
@ -7,7 +8,15 @@ let
in in
runCommand "${nameVersion.name}-multi-${nameVersion.version}" runCommand "${nameVersion.name}-multi-${nameVersion.version}"
# out as the first output is an exception exclusive to glibc # out as the first output is an exception exclusive to glibc
{ outputs = [ "out" "bin" "dev" ]; } # TODO: no static version here (yet) {
outputs = [ "out" "bin" "dev" ]; # TODO: no static version here (yet)
passthru = {
libgcc = lib.lists.filter (x: x!=null) [
(glibc64.libgcc or null)
(glibc32.libgcc or null)
];
};
}
'' ''
mkdir -p "$out/lib" mkdir -p "$out/lib"
ln -s '${glibc64.out}'/lib/* "$out/lib" ln -s '${glibc64.out}'/lib/* "$out/lib"