From dee9af932383801ccd5bbb5f48109a556c1b632c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 9 May 2022 09:57:59 -0400 Subject: [PATCH] bintools: Add isXXX flags to check linker type --- pkgs/build-support/bintools-wrapper/default.nix | 9 +++++++++ pkgs/development/compilers/llvm/10/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/11/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/12/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/13/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/14/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/7/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/8/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/9/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/git/bintools/default.nix | 2 +- pkgs/development/tools/misc/binutils/default.nix | 5 +++++ pkgs/os-specific/darwin/binutils/default.nix | 1 + 12 files changed, 24 insertions(+), 9 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index c2d67169c9ca..2a1a8699485c 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -31,6 +31,13 @@ # Darwin code signing support utilities , postLinkSignHook ? null, signingUtils ? null + +# Linker type +, isLld ? bintools.isLld or false +, isCctools ? bintools.isCctools or false +, isGNU ? bintools.isGNU or false +, isGold ? bintools.isGold or false +, isBfd ? bintools.isBfd or false }: with lib; @@ -113,6 +120,8 @@ stdenv.mkDerivation { passthru = { inherit bintools libc nativeTools nativeLibc nativePrefix; + inherit isLld isCctools isGNU isGold isBfd; + emacsBufferSetup = pkgs: '' ; We should handle propagation here too (mapc diff --git a/pkgs/development/compilers/llvm/10/bintools/default.nix b/pkgs/development/compilers/llvm/10/bintools/default.nix index 53f7941e3369..5735bf5a6858 100644 --- a/pkgs/development/compilers/llvm/10/bintools/default.nix +++ b/pkgs/development/compilers/llvm/10/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/11/bintools/default.nix b/pkgs/development/compilers/llvm/11/bintools/default.nix index 53f7941e3369..5735bf5a6858 100644 --- a/pkgs/development/compilers/llvm/11/bintools/default.nix +++ b/pkgs/development/compilers/llvm/11/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/12/bintools/default.nix b/pkgs/development/compilers/llvm/12/bintools/default.nix index 53f7941e3369..5735bf5a6858 100644 --- a/pkgs/development/compilers/llvm/12/bintools/default.nix +++ b/pkgs/development/compilers/llvm/12/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/13/bintools/default.nix b/pkgs/development/compilers/llvm/13/bintools/default.nix index e01e152d159f..4c16957aeb4d 100644 --- a/pkgs/development/compilers/llvm/13/bintools/default.nix +++ b/pkgs/development/compilers/llvm/13/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix index e01e152d159f..4c16957aeb4d 100644 --- a/pkgs/development/compilers/llvm/14/bintools/default.nix +++ b/pkgs/development/compilers/llvm/14/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/7/bintools/default.nix b/pkgs/development/compilers/llvm/7/bintools/default.nix index 53f7941e3369..5735bf5a6858 100644 --- a/pkgs/development/compilers/llvm/7/bintools/default.nix +++ b/pkgs/development/compilers/llvm/7/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/8/bintools/default.nix b/pkgs/development/compilers/llvm/8/bintools/default.nix index 53f7941e3369..5735bf5a6858 100644 --- a/pkgs/development/compilers/llvm/8/bintools/default.nix +++ b/pkgs/development/compilers/llvm/8/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/9/bintools/default.nix b/pkgs/development/compilers/llvm/9/bintools/default.nix index 53f7941e3369..5735bf5a6858 100644 --- a/pkgs/development/compilers/llvm/9/bintools/default.nix +++ b/pkgs/development/compilers/llvm/9/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/git/bintools/default.nix b/pkgs/development/compilers/llvm/git/bintools/default.nix index e01e152d159f..4c16957aeb4d 100644 --- a/pkgs/development/compilers/llvm/git/bintools/default.nix +++ b/pkgs/development/compilers/llvm/git/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index da2b4864552e..4fdda9d67d99 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -197,6 +197,11 @@ stdenv.mkDerivation { inherit targetPrefix; hasGold = enableGold; isGNU = true; + # TODO Currently platform.linker == "gold" has no effect outside + # of building GHC. If/when that's fixed, these flags should + # probably move to the invocations of bintools-wrapper + isGold = false; + isBfd = true; }; meta = with lib; { diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index c5bc50cafd71..a25306dcf351 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -65,6 +65,7 @@ stdenv.mkDerivation { passthru = { inherit targetPrefix; + isCctools = true; }; meta = {