From 77473cda6b5f9d7dc72a01df195536b14b2f9b02 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Fri, 26 Aug 2016 14:56:03 +0000 Subject: [PATCH] ghc: add relocation patch for all versions --- pkgs/development/compilers/ghc/7.0.4.nix | 2 +- pkgs/development/compilers/ghc/7.10.2.nix | 2 ++ pkgs/development/compilers/ghc/7.10.3.nix | 1 + pkgs/development/compilers/ghc/7.2.2.nix | 2 +- pkgs/development/compilers/ghc/7.4.2.nix | 2 +- pkgs/development/compilers/ghc/7.6.3.nix | 2 +- pkgs/development/compilers/ghc/7.8.3.nix | 2 ++ pkgs/development/compilers/ghc/7.8.4.nix | 2 ++ pkgs/development/compilers/ghc/8.0.1.nix | 1 + pkgs/development/compilers/ghc/head.nix | 1 + pkgs/development/compilers/ghc/nokinds.nix | 2 ++ .../compilers/ghc/relocation.patch | 19 +++++++++++++++++++ 12 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/compilers/ghc/relocation.patch diff --git a/pkgs/development/compilers/ghc/7.0.4.nix b/pkgs/development/compilers/ghc/7.0.4.nix index 7442c5ca53c8..099f1376c778 100644 --- a/pkgs/development/compilers/ghc/7.0.4.nix +++ b/pkgs/development/compilers/ghc/7.0.4.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { sha256 = "1a9b78d9d66c9c21de6c0932e36bb87406a4856f1611bf83bd44539bdc6ed0ed"; }; - patches = [ ./fix-7.0.4-clang.patch ]; + patches = [ ./fix-7.0.4-clang.patch ./relocation.patch ]; buildInputs = [ ghc perl gmp ncurses ]; diff --git a/pkgs/development/compilers/ghc/7.10.2.nix b/pkgs/development/compilers/ghc/7.10.2.nix index 2e96c999b9e0..e384a42a51f4 100644 --- a/pkgs/development/compilers/ghc/7.10.2.nix +++ b/pkgs/development/compilers/ghc/7.10.2.nix @@ -29,6 +29,8 @@ stdenv.mkDerivation rec { buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ]; + patches = [ ./relocation.patch ]; + enableParallelBuilding = true; outputs = [ "out" "doc" ]; diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index c059a89bde3b..31cf0b3c8bde 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -23,6 +23,7 @@ stdenv.mkDerivation rec { patches = [ docFixes + ./relocation.patch ./ghc-7.x-dont-pass-linker-flags-via-response-files.patch # https://github.com/NixOS/nixpkgs/issues/10752 ]; diff --git a/pkgs/development/compilers/ghc/7.2.2.nix b/pkgs/development/compilers/ghc/7.2.2.nix index 06f7cb9af2c4..31cac49135fc 100644 --- a/pkgs/development/compilers/ghc/7.2.2.nix +++ b/pkgs/development/compilers/ghc/7.2.2.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { sha256 = "0g87d3z9275dniaqzkf56qfgzp1msd89nqqhhm2gkc6iga072spz"; }; - patches = [ ./fix-7.2.2-clang.patch ]; + patches = [ ./fix-7.2.2-clang.patch ./relocation.patch ]; buildInputs = [ ghc perl gmp ncurses ]; diff --git a/pkgs/development/compilers/ghc/7.4.2.nix b/pkgs/development/compilers/ghc/7.4.2.nix index c74461a064e6..63ce7ddfacc7 100644 --- a/pkgs/development/compilers/ghc/7.4.2.nix +++ b/pkgs/development/compilers/ghc/7.4.2.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { sha256 = "0vc3zmxqi4gflssmj35n5c8idbvyrhd88abi50whbirwlf4i5vpj"; }; - patches = [ ./fix-7.4.2-clang.patch ]; + patches = [ ./fix-7.4.2-clang.patch ./relocation.patch ]; buildInputs = [ ghc perl gmp ncurses ]; diff --git a/pkgs/development/compilers/ghc/7.6.3.nix b/pkgs/development/compilers/ghc/7.6.3.nix index 6ee629cc9804..5a933a23aa8b 100644 --- a/pkgs/development/compilers/ghc/7.6.3.nix +++ b/pkgs/development/compilers/ghc/7.6.3.nix @@ -17,7 +17,7 @@ in stdenv.mkDerivation rec { sha256 = "1669m8k9q72rpd2mzs0bh2q6lcwqiwd1ax3vrard1dgn64yq4hxx"; }; - patches = [ ./fix-7.6.3-clang.patch ]; + patches = [ ./fix-7.6.3-clang.patch ./relocation.patch ]; buildInputs = [ ghc perl gmp ncurses ]; diff --git a/pkgs/development/compilers/ghc/7.8.3.nix b/pkgs/development/compilers/ghc/7.8.3.nix index 55f8655c7009..f631ad923560 100644 --- a/pkgs/development/compilers/ghc/7.8.3.nix +++ b/pkgs/development/compilers/ghc/7.8.3.nix @@ -9,6 +9,8 @@ stdenv.mkDerivation rec { sha256 = "0n5rhwl83yv8qm0zrbaxnyrf8x1i3b6si927518mwfxs96jrdkdh"; }; + patches = [ ./relocation.patch ]; + buildInputs = [ ghc perl gmp ncurses ]; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index 6e10b1443c8f..f41a1cf7d98d 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -9,6 +9,8 @@ stdenv.mkDerivation (rec { sha256 = "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3"; }; + patches = [ ./relocation.patch ]; + buildInputs = [ ghc perl gmp ncurses ]; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/ghc/8.0.1.nix b/pkgs/development/compilers/ghc/8.0.1.nix index 8341fca9f42f..02a78f60550f 100644 --- a/pkgs/development/compilers/ghc/8.0.1.nix +++ b/pkgs/development/compilers/ghc/8.0.1.nix @@ -23,6 +23,7 @@ stdenv.mkDerivation rec { patches = [ ./ghc-8.x-dont-pass-linker-flags-via-response-files.patch # https://github.com/NixOS/nixpkgs/issues/10752 + ./relocation.patch # Fix https://ghc.haskell.org/trac/ghc/ticket/12130 (fetchFilteredPatch { url = https://git.haskell.org/ghc.git/patch/4d71cc89b4e9648f3fbb29c8fcd25d725616e265; sha256 = "0syaxb4y4s2dc440qmrggb4vagvqqhb55m6mx12rip4i9qhxl8k0"; }) diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 0f3b57949b7a..b214c1feb23e 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -18,6 +18,7 @@ in stdenv.mkDerivation rec { patches = [ ./ghc-7.x-dont-pass-linker-flags-via-response-files.patch # https://github.com/NixOS/nixpkgs/issues/10752 + ./relocation.patch ]; postUnpack = '' diff --git a/pkgs/development/compilers/ghc/nokinds.nix b/pkgs/development/compilers/ghc/nokinds.nix index ca0a78eb0b67..a041ff02f936 100644 --- a/pkgs/development/compilers/ghc/nokinds.nix +++ b/pkgs/development/compilers/ghc/nokinds.nix @@ -38,6 +38,8 @@ stdenv.mkDerivation rec { sha256 = "183l4v6aw52r3ydwl8bxg1lh3cwfakb35rpy6mjg23dqmqsynmcn"; }; + patches = [ ./relocation.patch ]; + postUnpack = '' pushd ghc-${builtins.substring 0 7 rev} echo ${version} >VERSION diff --git a/pkgs/development/compilers/ghc/relocation.patch b/pkgs/development/compilers/ghc/relocation.patch new file mode 100644 index 000000000000..c5b1f6c560da --- /dev/null +++ b/pkgs/development/compilers/ghc/relocation.patch @@ -0,0 +1,19 @@ +diff --git a/rts/Linker.c b/rts/Linker.c +--- a/rts/Linker.c ++++ b/rts/Linker.c +@@ -5681,7 +5681,13 @@ + *(Elf64_Sword *)P = (Elf64_Sword)value; + #endif + break; +- ++/* These two relocations were introduced in glibc 2.23 and binutils 2.26. ++ But in order to use them the system which compiles the bindist for GHC needs ++ to have glibc >= 2.23. So only use them if they're defined. */ ++#if defined(R_X86_64_REX_GOTPCRELX) && defined(R_X86_64_GOTPCRELX) ++ case R_X86_64_REX_GOTPCRELX: ++ case R_X86_64_GOTPCRELX: ++#endif + case R_X86_64_GOTPCREL: + { + StgInt64 gotAddress = (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)->addr; +