Skip to content
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{843,861}: add musl variants of "llvm-targets" #43306

Merged
merged 2 commits into from Jul 11, 2018

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented Jul 10, 2018

Currently only the 3-element targets are available w/musl,
which is especially unfortunate since this means when
target'ing raspberryPi w/musl ("muslpi" in our tree)
GHC sees "armv6l-unknown-linux-musleabihf" and drops
the last bit, which is bad for two reasons:

  • GHC's llvm-targets file doesn't have an entry for armv6l-unknown-linux,
    preventing compilation/use in this configuration.
  • Information about float mode to use (hard vs soft) is lost,
    at least in this style of target string.

I think the second reason is actually the explanation for the first,
and is why GHC special-cases "-gnueabi" which this PR extends
to similarly treat "-musleabi".


This only impacts GHC builds using musl, to avoid the rebuild (and following what was done for Android).
If later this is expanded I think only makes sense/has impact when LLVM is used,
so same configurations as in #43303.

I was "on the fence" with preserving "-musl*" (not just "-musleabi*") to ensure in a mixed
environment there's less confusion about how to extend/interpret "x86_64-unknown-linux",
but in the end decided to just match the "-gnueabi*" behavior and revisit if there's
motivation from experiences "in the wild".

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Tested a number of configurations building basic packages (earlier today),
still rebuilding-all-the-haskell after a small rebase.

Inspected output of ${targetPrefix}ghc --info, although I'm not a GHC expert
but things seem as they should be before/after.

Fixes build with "muslpi" (armv6l-unknown-linux-musleabihf).

This was done via patch at first but it wouldn't apply to both at once,
and it's probably best to stick to just having musl clones for now
(instead of patching 8.6.1 targets into 8.4.3 and hoping that's okay).
@matthewbauer
Copy link
Member

/cc @bgamari

@dtzWill
Copy link
Member Author

dtzWill commented Jul 11, 2018

(minor refresh to fix stray extra newline)

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@dtzWill dtzWill merged commit be0a056 into NixOS:master Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants