-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
GHC 8.0.2: use -split-sections #21589
Conversation
@domenkozar, thanks for your PR! By analyzing the history of the files in this pull request, we identified @peti, @LnL7 and @cstrahan to be potential reviewers. |
647a821
to
29277f1
Compare
# For GHC 8.0.2 we use split-sections instead | ||
# Unsupported for Darwin/Clang, see http://hackage.haskell.org/trac/ghc/ticket/4013 | ||
, enableSplitObjs ? (!stdenv.isDarwin && (stdenv.lib.versionAtLeast "8.0.1" ghc.version)) | ||
, enableSplitSections ? (!stdenv.isDarwin && (stdenv.lib.versionOlder "8.0.1" ghc.version)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need a new argument enableSplitSections
for this change? It seems to me like "split objects" and "split sections" are two different implementations of the same concept, and IMHO it seems fine to control both with one option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also dead_strip
for OSX, but it doesn't work all the time.
I was thinking of joining these, but based on different situations you might need to turn on/off different implementations of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could enable all of these with a single argument and disable those situations that don't work (for -dead_strip). If somone wants a different strategy, they can just disable and pass some --ghc-option
flags. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that sounds like a good compromise. We can also abstract the issue somewhat by adding an appropriate haskell.lib.dontDeadStrip
function that hides the implementation. If it turns out that we need to control those flags in dozens of packages, then I'm all for (a) adding an appropriate option to the generic builder and (b) teaching cabal2nix to generate them when necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peti sounds good. I think we should rename the option though, since objsplit would then imply section split for GHC 8.0.2 and we're overloading the term. Can we error out if enableSplitObjs
is set and use general term such as enableDeadCodeElimination
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that's a good solution. I like the name, too.
29277f1
to
ca6eedb
Compare
Will you pick up this PR? It's a really nice feature and I'd love to have it in before we're forking off a new release branch. |
Yes will do. Planning to clean this up very soon. |
-split-sections replaced -split-objs with following upsides: 1) -split-objs adds considerable overhead to compile time 2) combined with stripping, it causes issues when cross-compiling For upstream see https://ghc.haskell.org/trac/ghc/ticket/8405 This is supported only for Linux/Windows using ld linker. GHC master also turns on -split-sections by default. Example using stack: Without splitting $ du /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2 4 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share/bash-completion/completions 4 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share/bash-completion 4 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share 23416 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/bin 23420 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2 With -split-objs $ du /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2 20632 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/bin 4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share/bash-completion/completions 4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share/bash-completion 4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share 20636 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2 With -split-sections $ du /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2 4 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share/bash-completion/completions 4 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share/bash-completion 4 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share 20672 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/bin 20676 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2 Note: you currently need following overrides to build stack on 802: vector-algorithms = dontCheck super.vector-algorithms; path-io = doJailbreak super.path-io; stack = doJailbreak super.stack; Note: Should also work on GHC 8.0.1, but I'm being careful here. We could backport later on.
ca6eedb
to
f031f31
Compare
cc @peti ready for review :) |
See the commit for more information.
cc @peti, I haven't tested much (built stack and darcs) but upstream did quite some testing.