Merge pull request #296219 from ConnorBaker/fix/gcc-cross-nested-libs
gcc: link $lib/lib -> $lib/$targetConfig correctly and consistently
This commit is contained in:
commit
c7293f7e6e
|
@ -1,6 +1,7 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
, enableMultilib
|
, enableMultilib
|
||||||
|
, targetConfig
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -196,6 +197,13 @@ originalAttrs: (stdenv.mkDerivation (finalAttrs: originalAttrs // {
|
||||||
mkdir -p "$out/''${targetConfig}/lib"
|
mkdir -p "$out/''${targetConfig}/lib"
|
||||||
mkdir -p "''${!outputLib}/''${targetConfig}/lib"
|
mkdir -p "''${!outputLib}/''${targetConfig}/lib"
|
||||||
'' +
|
'' +
|
||||||
|
# if cross-compiling, link from $lib/lib to $lib/${targetConfig}.
|
||||||
|
# since native-compiles have $lib/lib as a directory (not a
|
||||||
|
# symlink), this ensures that in every case we can assume that
|
||||||
|
# $lib/lib contains the .so files
|
||||||
|
lib.optionalString (with stdenv; targetPlatform.config != hostPlatform.config) ''
|
||||||
|
ln -Ts "''${!outputLib}/''${targetConfig}/lib" $lib/lib
|
||||||
|
'' +
|
||||||
# Make `lib64` symlinks to `lib`.
|
# Make `lib64` symlinks to `lib`.
|
||||||
lib.optionalString (!enableMultilib && stdenv.hostPlatform.is64bit && !stdenv.hostPlatform.isMips64n32) ''
|
lib.optionalString (!enableMultilib && stdenv.hostPlatform.is64bit && !stdenv.hostPlatform.isMips64n32) ''
|
||||||
ln -s lib "$out/''${targetConfig}/lib64"
|
ln -s lib "$out/''${targetConfig}/lib64"
|
||||||
|
|
|
@ -83,10 +83,6 @@ in
|
||||||
lib.optionalString (!langC) ''
|
lib.optionalString (!langC) ''
|
||||||
rm -f $out/lib/libgcc_s.so*
|
rm -f $out/lib/libgcc_s.so*
|
||||||
''
|
''
|
||||||
+ lib.optionalString (hostPlatform != targetPlatform) ''
|
|
||||||
mkdir -p $lib/lib/
|
|
||||||
ln -s ${targetPlatformSlash}lib $lib/lib
|
|
||||||
''
|
|
||||||
|
|
||||||
# TODO(amjoseph): remove the `libgcc_s.so` symlinks below and replace them
|
# TODO(amjoseph): remove the `libgcc_s.so` symlinks below and replace them
|
||||||
# with a `-L${gccForLibs.libgcc}/lib` in cc-wrapper's
|
# with a `-L${gccForLibs.libgcc}/lib` in cc-wrapper's
|
||||||
|
|
|
@ -103,6 +103,7 @@ let inherit version;
|
||||||
disableBootstrap = atLeast11 && !stdenv.hostPlatform.isDarwin && (atLeast12 -> !profiledCompiler);
|
disableBootstrap = atLeast11 && !stdenv.hostPlatform.isDarwin && (atLeast12 -> !profiledCompiler);
|
||||||
|
|
||||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||||
|
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||||
|
|
||||||
patches = callFile ./patches {};
|
patches = callFile ./patches {};
|
||||||
|
|
||||||
|
@ -124,6 +125,7 @@ let inherit version;
|
||||||
buildPlatform
|
buildPlatform
|
||||||
hostPlatform
|
hostPlatform
|
||||||
targetPlatform
|
targetPlatform
|
||||||
|
targetConfig
|
||||||
patches
|
patches
|
||||||
crossMingw
|
crossMingw
|
||||||
stageNameAddon
|
stageNameAddon
|
||||||
|
@ -329,7 +331,7 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
|
||||||
++ optional (is7 && targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419"
|
++ optional (is7 && targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419"
|
||||||
++ optional (is7 && targetPlatform.isNetBSD) "--disable-libcilkrts";
|
++ optional (is7 && targetPlatform.isNetBSD) "--disable-libcilkrts";
|
||||||
|
|
||||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
inherit targetConfig;
|
||||||
|
|
||||||
buildFlags =
|
buildFlags =
|
||||||
# we do not yet have Nix-driven profiling
|
# we do not yet have Nix-driven profiling
|
||||||
|
|
Loading…
Reference in New Issue
Block a user