diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-05-15 17:41:16 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-05-31 14:59:14 +0000 |
commit | 603f80066eacdbd666e04adf5239934b09be2c34 (patch) | |
tree | d1dd55f78af46919179c340d5486d51bb7a71248 /pkgs/build-support/bintools-wrapper | |
parent | e4427132775b9c7fce840e6230786407326686e4 (diff) |
bintools-wrapper: Add `sharedLibraryLoader` parameter
This is used instead of `libc_lib` in case the shared library loader / "interpreter" is not provided by the libc derivation.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index b2b47901981d8..74681aaedcca2 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -9,6 +9,7 @@ , lib , stdenvNoCC , bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null +, sharedLibraryLoader ? if libc == null then null else lib.getLib libc , nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , propagateDoc ? bintools != null && bintools ? man , extraPackages ? [], extraBuildCommands ? "" @@ -54,19 +55,19 @@ let # The dynamic linker has different names on different platforms. This is a # shell glob that ought to match it. dynamicLinker = - /**/ if libc == null then null - else if targetPlatform.libc == "musl" then "${libc_lib}/lib/ld-musl-*" + /**/ if sharedLibraryLoader == null then null + else if targetPlatform.libc == "musl" then "${sharedLibraryLoader}/lib/ld-musl-*" else if (targetPlatform.libc == "bionic" && targetPlatform.is32bit) then "/system/bin/linker" else if (targetPlatform.libc == "bionic" && targetPlatform.is64bit) then "/system/bin/linker64" - else if targetPlatform.libc == "nblibc" then "${libc_lib}/libexec/ld.elf_so" - else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2" - else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2" - else if targetPlatform.system == "powerpc64le-linux" then "${libc_lib}/lib/ld64.so.2" + else if targetPlatform.libc == "nblibc" then "${sharedLibraryLoader}/libexec/ld.elf_so" + else if targetPlatform.system == "i686-linux" then "${sharedLibraryLoader}/lib/ld-linux.so.2" + else if targetPlatform.system == "x86_64-linux" then "${sharedLibraryLoader}/lib/ld-linux-x86-64.so.2" + else if targetPlatform.system == "powerpc64le-linux" then "${sharedLibraryLoader}/lib/ld64.so.2" # ARM with a wildcard, which can be "" or "-armhf". - else if (with targetPlatform; isAarch32 && isLinux) then "${libc_lib}/lib/ld-linux*.so.3" - else if targetPlatform.system == "aarch64-linux" then "${libc_lib}/lib/ld-linux-aarch64.so.1" - else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1" - else if targetPlatform.isMips then "${libc_lib}/lib/ld.so.1" + else if (with targetPlatform; isAarch32 && isLinux) then "${sharedLibraryLoader}/lib/ld-linux*.so.3" + else if targetPlatform.system == "aarch64-linux" then "${sharedLibraryLoader}/lib/ld-linux-aarch64.so.1" + else if targetPlatform.system == "powerpc-linux" then "${sharedLibraryLoader}/lib/ld.so.1" + else if targetPlatform.isMips then "${sharedLibraryLoader}/lib/ld.so.1" else if targetPlatform.isDarwin then "/usr/lib/dyld" else if targetPlatform.isFreeBSD then "/libexec/ld-elf.so.1" else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" @@ -224,10 +225,10 @@ stdenv.mkDerivation { ## ## Dynamic linker support ## - + '' + + optionalString (sharedLibraryLoader != null) '' if [[ -z ''${dynamicLinker+x} ]]; then echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2 - local dynamicLinker="${libc_lib}/lib/ld*.so.?" + local dynamicLinker="${sharedLibraryLoader}/lib/ld*.so.?" fi '' @@ -246,9 +247,9 @@ stdenv.mkDerivation { ${if targetPlatform.isDarwin then '' printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook - '' else '' - if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then - echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 + '' else lib.optionalString (sharedLibraryLoader != null) '' + if [ -e ${sharedLibraryLoader}/lib/32/ld-linux.so.2 ]; then + echo ${sharedLibraryLoader}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 fi touch $out/nix-support/ld-set-dynamic-linker ''} |