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.
This commit is contained in:
Adam Joseph 2022-08-05 11:02:47 -07:00
parent b02b965b0d
commit cbc80ff32b
2 changed files with 15 additions and 0 deletions

View File

@ -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
}

View File

@ -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
''