From 23cc0c4420d3b2d5fb023f2368ba7d11412c1fba Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 25 Apr 2017 19:37:22 -0400 Subject: [PATCH 1/3] lib: Whitelist two ABIs used on Arm --- lib/systems/parse.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index f6315b8ad2a9..26744322e9e4 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -89,6 +89,8 @@ rec { msvc = {}; eabi = {}; androideabi = {}; + gnueabi = {}; + gnueabihf = {}; unknown = {}; }; From 85b4d30c0b464f6431eac6c50687111cfc69eb22 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 11 Feb 2017 19:28:13 -0500 Subject: [PATCH 2/3] binutils: Respect the targetPlatform Use `buildPackages.binutils` to get build = host != target binutils, i.e. the old `binutilsCross`, and use `buildPackages.buildPackages.binutils` to get build = host = target binutils, i.e. the old `binutils`. `buildPackages` chains like this are supposed to remove the need for all such `*Cross` derivations. We start with binutils because it's comparatively easy. No hashes of cross-tests should be changed --- pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 12 +++++++----- pkgs/top-level/all-packages.nix | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix index 8b166fb5b49f..47c61aaad818 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix @@ -70,8 +70,6 @@ let pkgs = pkgsFun ({inherit system;} // selectedCrossSystem); - inherit (pkgs.buildPackages) stdenv nukeReferences cpio binutilsCross; - glibc = pkgs.buildPackages.libcCross; bash = pkgs.bash; findutils = pkgs.findutils; @@ -126,11 +124,15 @@ rec { build = - stdenv.mkDerivation { + pkgs.buildPackages.stdenv.mkDerivation { name = "stdenv-bootstrap-tools-cross"; crossConfig = pkgs.hostPlatform.config; - buildInputs = [nukeReferences cpio binutilsCross]; + buildInputs = [ + pkgs.buildPackages.nukeReferences + pkgs.buildPackages.cpio + pkgs.buildPackages.binutils + ]; buildCommand = '' set -x @@ -261,7 +263,7 @@ rec { allowedReferences = []; }; - dist = stdenv.mkDerivation { + dist = pkgs.buildPackages.stdenv.mkDerivation { name = "stdenv-bootstrap-tools-cross"; buildCommand = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5da33b382446..a351284632bb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6336,10 +6336,13 @@ with pkgs; binutils = if stdenv.isDarwin then darwin.binutils else binutils-raw; - binutils-raw = callPackage ../development/tools/misc/binutils { inherit noSysDirs; }; + binutils-raw = callPackage ../development/tools/misc/binutils { + # FHS sys dirs presumably only have stuff for the build platform + noSysDirs = (targetPlatform != buildPlatform) || noSysDirs; + cross = if targetPlatform != hostPlatform then targetPlatform else null; + }; - binutils_nogold = lowPrio (callPackage ../development/tools/misc/binutils { - inherit noSysDirs; + binutils_nogold = lowPrio (binutils-raw.override { gold = false; }); From 295315cc87acd13caa39ea87c1d8d010e7a587df Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 25 Apr 2017 21:18:29 -0400 Subject: [PATCH 3/3] binutilsCross: Remove and use `binutils` instead always See previous commit for what was done to `binutils` to make this possible. There were some uses of `forcedNativePackages` added. The combination of overrides with that attribute is highly spooky: it's often important that if an overridden package comes from it, the replaced arguments for that package come from it. Long term this package set and all the spookiness should be gone and irrelevant: "Move along, nothing to see here!" No hashes should be changed with this commit --- .../development/compilers/gcc/4.5/default.nix | 3 +-- .../development/compilers/gcc/4.8/default.nix | 7 +++--- .../development/compilers/gcc/4.9/default.nix | 7 +++--- pkgs/development/compilers/gcc/5/default.nix | 7 +++--- pkgs/development/compilers/gcc/6/default.nix | 7 +++--- .../compilers/gcc/snapshot/default.nix | 7 +++--- pkgs/development/compilers/ghc/head.nix | 12 +++++----- .../os-specific/windows/mingw-w64/default.nix | 4 ++-- pkgs/os-specific/windows/mingwrt/default.nix | 4 ++-- pkgs/os-specific/windows/w32api/default.nix | 4 ++-- pkgs/stdenv/adapters.nix | 6 ++--- pkgs/stdenv/cross/default.nix | 2 +- pkgs/top-level/all-packages.nix | 23 +++++++------------ 13 files changed, 40 insertions(+), 53 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 7f5e4f8c9a2d..19a538e613ee 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/default.nix @@ -20,7 +20,6 @@ , enableMultilib ? false , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -225,7 +224,7 @@ stdenv.mkDerivation ({ ++ (optional langJava boehmgc) ++ (optionals langJava [zip unzip]) ++ (optionals javaAwtGtk ([gtk2 pkgconfig libart_lgpl] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) ; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 72c22544d1eb..714554019e4c 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -171,8 +170,8 @@ let version = "4.8.5"; else " --with-headers=${libcCross.dev}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -294,7 +293,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 594a61fdedfe..3bf279635aa3 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -172,8 +171,8 @@ let version = "4.9.4"; else " --with-headers=${libcCross.dev}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -299,7 +298,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index f7d46deebcc7..25053542678a 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -176,8 +175,8 @@ let version = "5.4.0"; else " --with-headers=${getDev libcCross}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -309,7 +308,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 1496e910dd1c..57bb336ccbfe 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -172,8 +171,8 @@ let version = "6.3.0"; else " --with-headers=${getDev libcCross}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -297,7 +296,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index af48fdbd1598..6b08f2797903 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -26,7 +26,6 @@ , enablePlugin ? true # whether to support user-supplied plug-ins , name ? "gcc" , cross ? null -, binutilsCross ? null , libcCross ? null , crossStageStatic ? true , gnat ? null @@ -172,8 +171,8 @@ let version = "7-20170409"; else " --with-headers=${getDev libcCross}/include") + # Ensure that -print-prog-name is able to find the correct programs. (stdenv.lib.optionalString (crossMingw || crossDarwin) ( - " --with-as=${binutilsCross}/bin/${cross.config}-as" + - " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + " --with-as=${binutils}/bin/${cross.config}-as" + + " --with-ld=${binutils}/bin/${cross.config}-ld" )) + " --enable-__cxa_atexit" + " --enable-long-long" + @@ -297,7 +296,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optionals langJava [ boehmgc zip unzip ]) ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ++ (optionals (cross != null) [binutilsCross]) + ++ (optionals (cross != null) [binutils]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index ed6f4717446d..006a9f8fbc46 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -99,17 +99,17 @@ in stdenv.mkDerivation (rec { configureFlags = [ "CC=${stdenv.ccCross}/bin/${cross.config}-cc" - "LD=${stdenv.binutilsCross}/bin/${cross.config}-ld" - "AR=${stdenv.binutilsCross}/bin/${cross.config}-ar" - "NM=${stdenv.binutilsCross}/bin/${cross.config}-nm" - "RANLIB=${stdenv.binutilsCross}/bin/${cross.config}-ranlib" + "LD=${stdenv.binutils}/bin/${cross.config}-ld" + "AR=${stdenv.binutils}/bin/${cross.config}-ar" + "NM=${stdenv.binutils}/bin/${cross.config}-nm" + "RANLIB=${stdenv.binutils}/bin/${cross.config}-ranlib" "--target=${cross.config}" "--enable-bootstrap-with-devel-snapshot" ] ++ # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; - buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutilsCross ]; + buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ]; dontSetConfigureCross = true; @@ -118,6 +118,6 @@ in stdenv.mkDerivation (rec { cc = "${stdenv.ccCross}/bin/${cross.config}-cc"; - ld = "${stdenv.binutilsCross}/bin/${cross.config}-ld"; + ld = "${stdenv.binutils}/bin/${cross.config}-ld"; }; }) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index a9df0d29e09f..49612b0b4618 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, binutilsCross ? null, gccCross ? null +{ stdenv, fetchurl, binutils ? null, gccCross ? null , onlyHeaders ? false , onlyPthreads ? false }: @@ -27,7 +27,7 @@ stdenv.mkDerivation ({ cd mingw-w64-libraries/winpthreads ''; } else { - buildInputs = [ gccCross binutilsCross ]; + buildInputs = [ gccCross binutils ]; crossConfig = gccCross.crossConfig; diff --git a/pkgs/os-specific/windows/mingwrt/default.nix b/pkgs/os-specific/windows/mingwrt/default.nix index 286c63d01637..98461d690d92 100644 --- a/pkgs/os-specific/windows/mingwrt/default.nix +++ b/pkgs/os-specific/windows/mingwrt/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}: +{stdenv, fetchurl, binutils ? null, gccCross ? null, onlyHeaders ? false}: let name = "mingwrt-3.20"; @@ -20,7 +20,7 @@ stdenv.mkDerivation (rec { cp -R include $out ''; } else { - buildInputs = [ gccCross binutilsCross ]; + buildInputs = [ gccCross binutils ]; crossConfig = gccCross.crossConfig; diff --git a/pkgs/os-specific/windows/w32api/default.nix b/pkgs/os-specific/windows/w32api/default.nix index 2a5af71b5eca..3443fff9668d 100644 --- a/pkgs/os-specific/windows/w32api/default.nix +++ b/pkgs/os-specific/windows/w32api/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, xz, binutilsCross ? null +{ stdenv, fetchurl, xz, binutils ? null , gccCross ? null, onlyHeaders ? false }: let @@ -23,7 +23,7 @@ stdenv.mkDerivation ({ cp -R include $out ''; } else { - buildInputs = [ gccCross binutilsCross ]; + buildInputs = [ gccCross binutils ]; crossConfig = gccCross.crossConfig; diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 65a0bf98456c..7eab7ddb072c 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -56,7 +56,7 @@ rec { # Return a modified stdenv that adds a cross compiler to the # builds. - makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // { + makeStdenvCross = stdenv: cross: binutils: gccCross: stdenv // { # Overrides are surely not valid as packages built with this run on a # different platform. @@ -91,7 +91,7 @@ rec { name = name + "-" + cross.config; nativeBuildInputs = nativeBuildInputs ++ nativeInputsFromBuildInputs - ++ [ gccCross binutilsCross ] + ++ [ gccCross binutils ] ++ stdenv.lib.optional selfNativeBuildInput nativeDrv # without proper `file` command, libtool sometimes fails # to recognize 64-bit DLLs @@ -110,7 +110,7 @@ rec { crossConfig = cross.config; } // args.crossAttrs or {}); - inherit gccCross binutilsCross; + inherit gccCross binutils; ccCross = gccCross; }; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index dec4b0360925..7fe567251708 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -39,7 +39,7 @@ in bootStages ++ [ binutils cc else buildPackages.makeStdenvCross buildPackages.stdenv crossSystem - buildPackages.binutilsCross buildPackages.gccCrossStageFinal; + buildPackages.binutils buildPackages.gccCrossStageFinal; }) ] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a351284632bb..00243e82b9a6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4982,10 +4982,10 @@ with pkgs; libcCross = libcCross1; enableShared = false; # Why is this needed? - inherit (forcedNativePackages) binutilsCross; + inherit (forcedNativePackages) binutils; }; libc = libcCross1; - binutils = binutilsCross; + inherit (forcedNativePackages) binutils; cross = targetPlatform; }; @@ -4993,7 +4993,7 @@ with pkgs; gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapGCCCross { gcc = gccCrossStageStatic.gcc; libc = windows.mingw_headers2; - binutils = binutilsCross; + inherit (forcedNativePackages) binutils; cross = targetPlatform; }; @@ -5006,10 +5006,10 @@ with pkgs; # ), so don't even try. langCC = targetPlatform.config != "i686-pc-mingw32"; # Why is this needed? - inherit (forcedNativePackages) binutilsCross; + inherit (forcedNativePackages) binutils; }; libc = libcCross; - binutils = binutilsCross; + inherit (forcedNativePackages) binutils; cross = targetPlatform; }; @@ -6346,13 +6346,6 @@ with pkgs; gold = false; }); - binutilsCross = assert targetPlatform != buildPlatform; lowPrio ( - if targetPlatform.libc == "libSystem" then darwin.cctools_cross - else forcedNativePackages.binutils.override { - noSysDirs = true; - cross = targetPlatform; - }); - bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { }; bison3 = callPackage ../development/tools/parsing/bison/3.x.nix { }; bison = bison3; @@ -12305,7 +12298,7 @@ with pkgs; w32api = callPackage ../os-specific/windows/w32api { gccCross = gccCrossStageStatic; - binutilsCross = binutilsCross; + binutils = binutils; }; w32api_headers = w32api.override { @@ -12314,7 +12307,7 @@ with pkgs; mingw_runtime = callPackage ../os-specific/windows/mingwrt { gccCross = gccCrossMingw2; - binutilsCross = binutilsCross; + binutils = binutils; }; mingw_runtime_headers = mingw_runtime.override { @@ -12338,7 +12331,7 @@ with pkgs; mingw_w64 = callPackage ../os-specific/windows/mingw-w64 { gccCross = gccCrossStageStatic; - binutilsCross = binutilsCross; + binutils = binutils; }; mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64 {