diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2017-05-01 11:13:36 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-01 11:14:59 -0400 |
commit | 667abf17dced8b4a4cd2dc6a291a6f244ffa031f (patch) | |
tree | 95dd026ca573f955b4a5201016e83baf8f92f9a1 /compiler/codeGen/StgCmmPrim.hs | |
parent | c04bd55a8daaf254436cef02934215d0b4ccfa2f (diff) | |
download | haskell-667abf17dced8b4a4cd2dc6a291a6f244ffa031f.tar.gz |
Make LLVM output robust to -dead_strip on mach-o platforms
This reverses commit 1686f30951292e94bf3076ce8b3eafb0bcbba91d (Mangle
.subsections_via_symbols away., D3287), and implements proper support
for `-dead_strip` via the injection of `.alt_entry` symbols for the
function definition pointing to the beginning of the prefix data.
This is the result of a lengthy discussion with rwbarton, and the
following llvm-dev mailing list thread:
http://lists.llvm.org/pipermail/llvm-dev/2017-March/110733.html
The essential problem is that there is no reference from a function to
its info table. This combined with `.subsections_via_symbols`, which
llvm emits unconditionally, leads the linker to believe that the prefix
data is unnecessary and stripping it away if presented with the
`-dead_strip` flag.
The NCG has for this purpose special $dsp (dead strip preventer) symbols
and adds a relocation to the end of each function body pointing to that
function's $dsp symbol. We cannot easily do the same thing via LLVM.
Instead we use the `.alt_entry` directive on the function symbol, which
causes the linker to treat it as a continuation of the previous symbol,
namely the $dsp symbol. As a result the function body will not be
separated from its info table.
Reviewers: erikd, austin, rwbarton, bgamari
Reviewed By: bgamari
Subscribers: michalt, thomie
Differential Revision: https://phabricator.haskell.org/D3290
Diffstat (limited to 'compiler/codeGen/StgCmmPrim.hs')
0 files changed, 0 insertions, 0 deletions