summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix35
-rw-r--r--pkgs/stdenv/linux/default.nix4
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix1
3 files changed, 28 insertions, 12 deletions
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index d433ee4e7a4b..5e271db8bd1f 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -1,18 +1,23 @@
-{ stdenv, buildPackages
+{ stdenv, lib, buildPackages
, fetchurl, zlib, autoreconfHook264
+# Enabling all targets increases output size to a multiple.
+, withAllTargets ? false, libbfd, libopcodes
+, enableShared ? true
, noSysDirs, gold ? true, bison ? null
}:
let
+ reuseLibs = enableShared && withAllTargets;
+
# Remove gold-symbol-visibility patch when updating, the proper fix
# is now upstream.
# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=330b90b5ffbbc20c5de6ae6c7f60c40fab2e7a4f;hp=99181ccac0fc7d82e7dabb05dc7466e91f1645d3
version = "2.30";
basename = "binutils-${version}";
- inherit (stdenv.lib) optionals optionalString;
# The targetPrefix prepended to binary names to allow multiple binuntils on the
# PATH to both be usable.
- targetPrefix = optionalString (stdenv.targetPlatform != stdenv.hostPlatform) "${stdenv.targetPlatform.config}-";
+ targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
+ "${stdenv.targetPlatform.config}-";
in
stdenv.mkDerivation rec {
@@ -64,14 +69,14 @@ stdenv.mkDerivation rec {
# be satisfied on aarch64 platform. Add backported fix from bugzilla.
# https://sourceware.org/bugzilla/show_bug.cgi?id=22764
./relax-R_AARCH64_ABS32-R_AARCH64_ABS16-absolute.patch
- ] ++ stdenv.lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch;
+ ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch;
outputs = [ "out" "info" "man" ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
bison
- ] ++ stdenv.lib.optionals stdenv.targetPlatform.isiOS [
+ ] ++ lib.optionals stdenv.targetPlatform.isiOS [
autoreconfHook264
];
buildInputs = [ zlib ];
@@ -100,12 +105,14 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
# TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
- configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
+ configurePlatforms = [ "build" "host" ] ++ lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
- configureFlags = [
+ configureFlags =
+ (if enableShared then [ "--enable-shared" "--disable-static" ]
+ else [ "--disable-shared" "--enable-static" ])
+ ++ lib.optional withAllTargets "--enable-targets=all"
+ ++ [
"--enable-64-bit-bfd"
- "--disable-install-libbfd"
- "--disable-shared" "--enable-static"
"--with-system-zlib"
"--enable-deterministic-archives"
@@ -116,10 +123,16 @@ stdenv.mkDerivation rec {
# RUNPATH instead of RPATH on binaries. This is important because
# RUNPATH can be overriden using LD_LIBRARY_PATH at runtime.
"--enable-new-dtags"
- ] ++ optionals gold [ "--enable-gold" "--enable-plugins" ];
+ ] ++ lib.optionals gold [ "--enable-gold" "--enable-plugins" ];
doCheck = false; # fails
+ postFixup = lib.optionalString reuseLibs ''
+ rm "$out"/lib/lib{bfd,opcodes}-${version}.so
+ ln -s '${lib.getLib libbfd}/lib/libbfd-${version}.so' "$out/lib/"
+ ln -s '${lib.getLib libopcodes}/lib/libopcodes-${version}.so' "$out/lib/"
+ '';
+
# else fails with "./sanity.sh: line 36: $out/bin/size: not found"
doInstallCheck = stdenv.buildPlatform == stdenv.hostPlatform && stdenv.hostPlatform == stdenv.targetPlatform;
@@ -129,7 +142,7 @@ stdenv.mkDerivation rec {
inherit targetPrefix version;
};
- meta = with stdenv.lib; {
+ meta = with lib; {
description = "Tools for manipulating binaries (linker, assembler, etc.)";
longDescription = ''
The GNU Binutils are a collection of binary tools. The main
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index de58178a34ba..0745d9653a3e 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -189,7 +189,9 @@ in
# Rebuild binutils to use from stage2 onwards.
overrides = self: super: {
- binutils = super.binutils_nogold;
+ binutils-unwrapped = super.binutils-unwrapped.override {
+ gold = false;
+ };
inherit (prevStage)
ccWrapperStdenv
gcc-unwrapped coreutils gnugrep;
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 4fc9999b538c..dd23304cb45e 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -150,6 +150,7 @@ in with pkgs; rec {
for i in as ld ar ranlib nm strip readelf objdump; do
cp ${binutils.bintools.out}/bin/$i $out/bin
done
+ cp '${lib.getLib binutils.bintools}'/lib/* "$out/lib/"
chmod -R u+w $out