From cbc80ff32b7c827f6a780688f251a6d592a873d5 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 5 Aug 2022 11:02:47 -0700 Subject: [PATCH] gcc: add linkLib32toLib to create lib32->lib links Our gcc builder creates lib64->lib links to ensure that the "primary" libraries for the targetPlatform wind up in $PREFIX/lib. This is required in order for make-bootstrap-files.nix to work correctly. On mips, gcc follows the somewhat awkward IRIX convention of putting mips32 binaries in `lib` and mips64n32 binaries in `lib32`. So we need similar symlinks there. This may come up on other ILP32 platforms as well, so a general-purpose variable name is provided. --- pkgs/development/compilers/gcc/builder.sh | 5 +++++ .../development/compilers/gcc/common/pre-configure.nix | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index a9b33d9a3e4f..be0e97dac6cb 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -197,6 +197,11 @@ preInstall() { ln -s lib "$out/${targetConfig}/lib64" ln -s lib "${!outputLib}/${targetConfig}/lib64" fi + # Make ‘lib32’ symlinks to ‘lib’. + if [ -n "$linkLib32toLib" ]; then + ln -s lib "$out/${targetConfig}/lib32" + ln -s lib "${!outputLib}/${targetConfig}/lib32" + fi } diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix index 180d5f16e91f..01835b9fc107 100644 --- a/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -78,3 +78,13 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' + lib.optionalString (targetPlatform != hostPlatform && crossStageStatic) '' export inhibit_libc=true '' + +# On mips platforms, gcc follows the IRIX naming convention: +# +# $PREFIX/lib = mips32 +# $PREFIX/lib32 = mips64n32 +# $PREFIX/lib64 = mips64 +# ++ lib.optionalString (targetPlatform.isMips64n32) '' + export linkLib32toLib=1 +''