-
Notifications
You must be signed in to change notification settings - Fork 247
Use ld.gold in dev shells #1868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4c42c23
compiler/ghc: Add useLdGold option
TeofilC 9dfebf5
comp-builder: Remove ld override
TeofilC ae1dc6f
Set CONF_LD_LINKER_OPTS_STAGE2 to ensure gold gets used
TeofilC d9d344d
Set LD even if not cross-compiling if we want gold
TeofilC 19693d2
set full path of ld.gold
TeofilC a28a541
ifdLevel 1
TeofilC 5029aef
Don't use ld.gold on musl
TeofilC ccc3e44
link to musl ld.gold bug
TeofilC 5e7b89e
ifdLevel 2
TeofilC 95aa886
ifdLevel 3
TeofilC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
Comment on lines
+72
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After looking closer at this, I believe this is wrong. We do not unconditionally enable this in aarch32. |
||
|
||
, ghc-version ? src-spec.version | ||
, ghc-version-date ? null | ||
, src-spec | ||
|
@@ -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" | ||
|
@@ -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" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.