Skip to content

Commit

Permalink
binutils: Add support for overriding default ld
Browse files Browse the repository at this point in the history
  • Loading branch information
bgamari authored and dtzWill committed Jan 7, 2018
1 parent 066ec6a commit 37b2f59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkgs/development/tools/misc/binutils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
, fetchurl, zlib
, buildPlatform, hostPlatform, targetPlatform
, noSysDirs, gold ? true, bison ? null
# Which ld implementation to use by default?
, defaultLd ? null
}:

assert (builtins.elem defaultLd ["bfd" "gold" null]);
assert defaultLd == "gold" -> gold;

let
# Note to whoever is upgrading this: 2.29 is broken.
# ('nix-build pkgs/stdenv/linux/make-bootstrap-tools.nix -A test' segfaults on aarch64)
Expand Down Expand Up @@ -102,7 +107,8 @@ stdenv.mkDerivation rec {
"--enable-deterministic-archives"
"--disable-werror"
"--enable-fix-loongson2f-nop"
] ++ optionals gold [ "--enable-gold" "--enable-plugins" ];
] ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
++ optional (defaultLd == "gold") "--enable-gold=default";

enableParallelBuilding = true;

Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7158,6 +7158,7 @@ with pkgs;
binutils-unwrapped = callPackage ../development/tools/misc/binutils {
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (targetPlatform != buildPlatform) || noSysDirs;
defaultLd = config.defaultLd or null;
};
binutils-raw = wrapBintoolsWith {
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
Expand All @@ -7167,6 +7168,7 @@ with pkgs;
binutils_nogold = lowPrio (binutils-raw.override {
bintools = binutils-raw.bintools.override {
gold = false;
defaultLd = "bfd";
};
});

Expand Down

0 comments on commit 37b2f59

Please sign in to comment.