From ff6aeefb916a0dd1fad2825d4f08311df275828b Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 28 Feb 2020 21:17:10 +0100 Subject: [PATCH] ghc-8.8.3: really use ld.gold (port #80466) --- pkgs/development/compilers/ghc/8.8.3.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.8.3.nix b/pkgs/development/compilers/ghc/8.8.3.nix index 43d4b84c5f805..e4ece9b8d8c16 100644 --- a/pkgs/development/compilers/ghc/8.8.3.nix +++ b/pkgs/development/compilers/ghc/8.8.3.nix @@ -84,6 +84,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.8.3"; @@ -110,7 +112,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -147,18 +149,24 @@ stdenv.mkDerivation (rec { # TODO(@Ericson2314): Always pass "--target" and always prefix. configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ "--datadir=$doc/share/doc/ghc" "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" - ] ++ stdenv.lib.optionals (libffi != null) ["--with-system-libffi" "--with-ffi-includes=${targetPackages.libffi.dev}/include" "--with-ffi-libraries=${targetPackages.libffi.out}/lib" + ] ++ stdenv.lib.optionals (libffi != null) [ + "--with-system-libffi" + "--with-ffi-includes=${targetPackages.libffi.dev}/include" + "--with-ffi-libraries=${targetPackages.libffi.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && !enableIntegerSimple) [ - "--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib" + "--with-gmp-includes=${targetPackages.gmp.dev}/include" + "--with-gmp-libraries=${targetPackages.gmp.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ - "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + "--with-iconv-includes=${libiconv}/include" + "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"