Mangle .subsections_via_symbols away.
ClosedPublic

Authored by angerman on Mar 6 2017, 9:11 AM.

Details

Summary

This is a rather stupid mangler hack. However, when using prefix data with
llvm, on systems that support -dead_strip (macOS, iOS), the prefix data is
stipped.

llvm generiously adds .subsections_via_symbols for macho in any case.

Thus we use our trusted mangler to drop the .subsections_via_symbols
line from the assembly.

This ultimately means that for (macOS, llvm), and (iOS, llvm) will not
benefit from -dead_strip. Yet, this patch will allow building ghc on macOS
again.

Test Plan

build ghc with llvm on macOS

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
angerman created this revision.Mar 6 2017, 9:11 AM

This should fix the breakage introduced in D2911.

rwbarton added inline comments.Mar 6 2017, 9:13 AM
compiler/llvmGen/LlvmMangler.hs
15–16

(then I think all these new imports are redundant, too)

63–65

I think all this mustNotDeadStrip is actually redundant (this is the LLVM mangler so clearly we're in the LLVM workflow, and we'd only have .subsections_via_symbols on the platforms where we need to remove it).

angerman updated this revision to Diff 11589.Mar 6 2017, 9:21 AM
  • Drop redundancy.
rwbarton accepted this revision.Mar 6 2017, 9:22 AM
This revision is now accepted and ready to land.Mar 6 2017, 9:22 AM
bgamari accepted this revision.Mar 6 2017, 9:58 AM

Yes, this sadly seems like the only option at this point.

This revision was automatically updated to reflect the committed changes.