From dbe556af9cb9d00c6c50d76a1c1abade5455ab2f Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 9 Nov 2020 17:47:50 -0500 Subject: [PATCH] binutils: Move patches in versioned dir We'll have multiple binutils to contend with. --- pkgs/development/libraries/libbfd/default.nix | 2 +- .../libraries/libopcodes/default.nix | 2 +- .../tools/misc/binutils/default.nix | 29 ++++++++++--------- ...OPERTY_X86_ISA_1_USED-note-if-needed.patch | 0 ...operly-add-X86_ISA_1_NEEDED-property.patch | 0 ...ly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch | 0 .../2.31}/always-search-rpath.patch | 0 .../2.31}/build-components-separately.patch | 0 .../{ => patches/2.31}/deterministic.patch | 0 .../2.31}/disambiguate-arm-targets.patch | 0 .../2.31}/gold-symbol-visibility.patch | 0 .../{ => patches/2.31}/no-plugins.patch | 0 12 files changed, 18 insertions(+), 15 deletions(-) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/always-search-rpath.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/build-components-separately.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/deterministic.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/disambiguate-arm-targets.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/gold-symbol-visibility.patch (100%) rename pkgs/development/tools/misc/binutils/{ => patches/2.31}/no-plugins.patch (100%) diff --git a/pkgs/development/libraries/libbfd/default.nix b/pkgs/development/libraries/libbfd/default.nix index 75db780b7bb..e622cc6be68 100644 --- a/pkgs/development/libraries/libbfd/default.nix +++ b/pkgs/development/libraries/libbfd/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { outputs = [ "out" "dev" ]; patches = binutils-unwrapped.patches ++ [ - ../../tools/misc/binutils/build-components-separately.patch + (binutils-unwrapped.patchesDir + "/build-components-separately.patch") (fetchpatch { url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch"; sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q"; diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix index 8db034683dc..f596ddfafc4 100644 --- a/pkgs/development/libraries/libopcodes/default.nix +++ b/pkgs/development/libraries/libopcodes/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { outputs = [ "out" "dev" ]; patches = binutils-unwrapped.patches ++ [ - ../../tools/misc/binutils/build-components-separately.patch + (binutils-unwrapped.patchesDir + "/build-components-separately.patch") ]; # We just want to build libopcodes diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index b352e63a27c..3807fd7a539 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -38,6 +38,7 @@ let url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2"; sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"; }); + patchesDir = ./patches + "/${minorVersion}"; in stdenv.mkDerivation { @@ -48,18 +49,18 @@ stdenv.mkDerivation { patches = [ # Make binutils output deterministic by default. - ./deterministic.patch + "${patchesDir}/deterministic.patch" # Bfd looks in BINDIR/../lib for some plugins that don't # exist. This is pointless (since users can't install plugins # there) and causes a cycle between the lib and bin outputs, so # get rid of it. - ./no-plugins.patch + "${patchesDir}/no-plugins.patch" # Help bfd choose between elf32-littlearm, elf32-littlearm-symbian, and # elf32-littlearm-vxworks in favor of the first. # https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766 - ./disambiguate-arm-targets.patch + "${patchesDir}/disambiguate-arm-targets.patch" # For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's # not clear why this behavior was decided upon but it has the unfortunate @@ -67,19 +68,21 @@ stdenv.mkDerivation { # shared objects when cross-compiling. Consequently, we are forced to # override this behavior, forcing ld to search DT_RPATH even when # cross-compiling. - ./always-search-rpath.patch - - ] ++ lib.optionals (!stdenv.targetPlatform.isVc4) - [ + "${patchesDir}/always-search-rpath.patch" + ] + # For version 2.31 exclusively + ++ lib.optionals (!stdenv.targetPlatform.isVc4 && minorVersion == "2.31") [ # https://sourceware.org/bugzilla/show_bug.cgi?id=22868 - ./gold-symbol-visibility.patch + ./patches/2.31/gold-symbol-visibility.patch # https://sourceware.org/bugzilla/show_bug.cgi?id=23428 # un-break features so linking against musl doesn't produce crash-only binaries - ./0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch - ./0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch - ./0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch - ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch; + ./patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch + ./patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch + ./patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch + ] + ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch + ; outputs = [ "out" "info" "man" ]; @@ -149,7 +152,7 @@ stdenv.mkDerivation { enableParallelBuilding = true; passthru = { - inherit targetPrefix; + inherit targetPrefix patchesDir; }; meta = with lib; { diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch b/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch b/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch b/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch diff --git a/pkgs/development/tools/misc/binutils/always-search-rpath.patch b/pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/always-search-rpath.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch diff --git a/pkgs/development/tools/misc/binutils/build-components-separately.patch b/pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/build-components-separately.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch diff --git a/pkgs/development/tools/misc/binutils/deterministic.patch b/pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/deterministic.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch diff --git a/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch b/pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch diff --git a/pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch b/pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch diff --git a/pkgs/development/tools/misc/binutils/no-plugins.patch b/pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch similarity index 100% rename from pkgs/development/tools/misc/binutils/no-plugins.patch rename to pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch