a naive but simple fix to resolve trac ticket 15207, because currently stgcrun.c when compiled with gcc and then assembled with clang/apple as/llvm assembler fails.

Authored by carter on Jun 3 2018, 3:10 PM.



current ghc master fails to build via gcc on darwin / mac osx.
This is because the dwarf metadata embedded in stgcrunner.c is rejected by the
apple assembler (and the llvm assembler) when the c source is compiled with gcc.
Additionally, the current stack walking RTS support is only for ELF, whereas
darwin is macho.

Test Plan

validate and also confirm that builds on mac osx with CC=gcc 7 or 8 work

carter created this revision.Jun 3 2018, 3:10 PM
niteria accepted this revision.Jun 3 2018, 4:51 PM
niteria added a subscriber: niteria.

LGTM. Sorry about the breakage, it worked on my Mac, so I assumed it'd be fine, but we lose nothing by gating on !darwin.

This revision is now accepted and ready to land.Jun 3 2018, 4:51 PM
bgamari requested changes to this revision.Jun 17 2018, 11:52 AM

I would much rather we had a better understanding of what is going on here before we brush the issue under the rug; afterall, it may also break in other configurations.

This revision now requires changes to proceed.Jun 17 2018, 11:52 AM

@bgamari can we revisit this:

  1. our current dwarf tooling is ELF only,
  1. GCC is is flatout broken on modern OSX otherwise

we could set it to only be MAC AND GCC

instead of all mac builds

though i'll do the nofib to evalute if the clang related RTS regressions still hold vs historical mac

bgamari added inline comments.Nov 2 2018, 12:09 PM

This definitely needs a better comment than this otherwise we will surely forgot why this is here. Really this deserves to be a short note with a reference to the ticket.

worth noting that https://phabricator.haskell.org/D4781 is the better fix

If there's a better fix, please abandon this diff.

i've a variant of this patch thats a tad fragile but lets me get a bindist

my test suite results are https://gist.github.com/cartazio/034b14301604b0b534932a05f2527e4b

@simonmar https://phabricator.haskell.org/D5340 is the alternative i have the doesn't disable dwarf / ccall intohaskell stack trace support, but its tantamount to always using apple / SOME clang for the C compiler / assembler on Darwin for this one file

So neither fix is committable in its current state, if I'm understanding correctly? How would you like to move forward with this, do you need some help?

bgamari abandoned this revision.Tue, Mar 26, 10:21 AM

Let's continue this on GitLab if necessary.