bintools: Add isXXX flags to check linker type

This commit is contained in:
Shea Levy 2022-05-09 09:57:59 -04:00
parent a73b59a157
commit dee9af9323
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
12 changed files with 24 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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; {

View File

@ -65,6 +65,7 @@ stdenv.mkDerivation {
passthru = {
inherit targetPrefix;
isCctools = true;
};
meta = {