-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
haskell: add the linkWithGold function to link packages with ld.gold #24692
Conversation
@basvandijk, thanks for your PR! By analyzing the history of the files in this pull request, we identified @peti, @domenkozar and @pikajude to be potential reviewers. |
@peti it would be interesting turning on |
@basvandijk I think those |
5f4309a
to
9ebb7cb
Compare
@nh2 agreed. I forced-pushed a commit to this PR that adds a reference to a PR for double-conversion to explicitly link with libm. |
BTW I initially used the following implementation but abandoned it because the current implementation is simpler and doesn't require rebuilding all Haskell packages. But it might be interesting to compare the two... |
Also support linking the double-conversion package with ld.gold.
9ebb7cb
to
c865b8e
Compare
@nh2 it would be great to also have your |
@basvandijk do you mean to add this example as a nixpkgs package? |
@nh2 no, I mean I would like to have a function like my
What is probably missing is that |
@basvandijk Yes; and I'm not currently working on that, so if you'd like to do it please go ahead, it would be awesome! Also, if you come across a problem involving linking functions from |
Ok this sounds like a nice weekend project. I'll see if I have some time for it. Thanks for the info! |
Great! Any thoughts on making it the default where possible? |
@basvandijk I found that Haskell executables built with lld in nix that also link
|
Also this type of patch or setting to |
@aristidb thanks for the merge. Could this also be cherry-picked on release-17.03? I would like to use this in production. |
I've created a separate issue #24744 for the problem that |
I wonder if |
@domenkozar Personally I think it shouldn't, unless it's a temporary hack. It should be fixed upstream, as |
Every package that uses |
@domenkozar With "upstream" I mean the package that declares the function, not the one that uses it (that would be infeasible, users shouldn't have to rely on the implementation detail with what C function a Haskell function is implemented). So in that case I think Do you think this will make any problem? |
If we can get |
There's a bug when you depend on a library that is linked with gold: https://ghc.haskell.org/trac/ghc/ticket/13810#comment:3 |
I have now confirmed that It wil pass it also to those linker invocations that create the individual Haskell module
in some cases. Putting |
…stead. Fixes ld.gold: fatal error: cannot mix -r with dynamic object error for dynamic linking. See NixOS/nixpkgs#24692 (comment)
…raries: m` instead. Fixes ld.gold: fatal error: cannot mix -r with dynamic object error for dynamic linking (also in profiling). See NixOS/nixpkgs#24692 (comment) Cherry-Picked-From: 8f81fb0 Cherry-Picked-By: Niklas Hambüchen <mail@nh2.me>
Anyone remembers why we didn't enable gold by default? |
@domenkozar No, I don't know. I know why we aren't using |
@domenkozar, @nh2: I think #80466 is the missing piece for gold as the default linker. |
This was inspired by https://www.reddit.com/r/haskell/comments/63shj7/link_with_the_gold_linker_for_faster_build_times/.