Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-stackage
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed Mar 7, 2023
2 parents ea72ac5 + 5240aeb commit ec85971
Show file tree
Hide file tree
Showing 18 changed files with 1,455 additions and 50 deletions.
11 changes: 1 addition & 10 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,7 @@ let
[ "--with-gcc=${stdenv.cc.targetPrefix}cc"
] ++
# BINTOOLS
(if stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid # might be better check to see if cc is clang/llvm?
# use gold as the linker on linux to improve link times
then [
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld.gold"
"--ghc-option=-optl-fuse-ld=gold"
"--ld-option=-fuse-ld=gold"
] else [
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
]
) ++ [
[
"--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
"--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
]
Expand Down
16 changes: 14 additions & 2 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ let self =
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64

, useLdGold ?
# might be better check to see if cc is clang/llvm?
# use gold as the linker on linux to improve link times
# do not use it on musl due to a ld.gold bug. See: <https://sourceware.org/bugzilla/show_bug.cgi?id=22266>.
(stdenv.targetPlatform.isLinux && !stdenv.targetPlatform.isAndroid && !stdenv.targetPlatform.isMusl)
|| stdenv.targetPlatform.isAarch32

, ghc-version ? src-spec.version
, ghc-version-date ? null
, src-spec
Expand Down Expand Up @@ -187,10 +194,11 @@ let
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
] ++ lib.optionals (targetPlatform.isAarch32) [
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
"CONF_LD_LINKER_OPTS_STAGE2=-fuse-ld=gold" # See: <https://gitlab.haskell.org/ghc/ghc/-/issues/22550#note_466656>
] ++ lib.optionals enableDWARF [
"--enable-dwarf-unwind"
"--with-libdw-includes=${lib.getDev elfutils}/include"
Expand Down Expand Up @@ -285,13 +293,17 @@ stdenv.mkDerivation (rec {
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString targetPlatform.isAarch32 ".gold"}"
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${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"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
'' + lib.optionalString (targetPlatform == hostPlatform && useLdGold)
# set LD explicitly if we want gold even if we aren't cross compiling
''
export LD="${targetCC.bintools}/bin/ld.gold"
'' + lib.optionalString (targetPlatform.isWindows) ''
export DllWrap="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}dllwrap"
export Windres="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}windres"
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions lib/pkgconf-nixpkgs-map.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4119,12 +4119,6 @@ pkgs:
"ply-boot-client" = [ "plymouth" ];
"ply-splash-core" = [ "plymouth" ];
"ply-splash-graphics" = [ "plymouth" ];
"libpmem2" = [ "pmdk" ];
"libpmemblk" = [ "pmdk" ];
"libpmemlog" = [ "pmdk" ];
"libpmemobj" = [ "pmdk" ];
"libpmem" = [ "pmdk" ];
"libpmempool" = [ "pmdk" ];
"pmix" = [ "pmix" ];
"pm-utils" = [ "pmutils" ];
"libpodofo" = [ "podofo" ];
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ec85971

Please sign in to comment.