summaryrefslogtreecommitdiff
path: root/compiler/NOTES
diff options
context:
space:
mode:
authorMoritz Angermann <moritz@lichtzwerge.de>2014-11-19 16:38:22 -0600
committerAustin Seipp <austin@well-typed.com>2014-11-19 17:03:06 -0600
commit53a4742d037da2bfd00d1d34a8ea0d49d4cdb490 (patch)
tree1922721e21e3b6618ff9b7184d9dc96e9145e535 /compiler/NOTES
parent146dd138e2c3b4ec9b211dcbcedf752aeb79d3d1 (diff)
downloadhaskell-53a4742d037da2bfd00d1d34a8ea0d49d4cdb490.tar.gz
Allow -dead_strip linking on platforms with .subsections_via_symbols
Summary: This allows to link objects produced with the llvm code generator to be linked with -dead_strip. This applies to at least the iOS cross compiler and OS X compiler. Signed-off-by: Moritz Angermann <moritz@lichtzwerge.de> Test Plan: Create a ffi library and link it with -dead_strip. If the resulting binary does not crash, the patch works as advertised. Reviewers: rwbarton, simonmar, hvr, dterei, mzero, ezyang, austin Reviewed By: dterei, ezyang, austin Subscribers: thomie, mzero, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D206
Diffstat (limited to 'compiler/NOTES')
-rw-r--r--compiler/NOTES16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/NOTES b/compiler/NOTES
new file mode 100644
index 0000000000..14a1f80b41
--- /dev/null
+++ b/compiler/NOTES
@@ -0,0 +1,16 @@
+Note [Subsections Via Symbols]
+
+If we are using the .subsections_via_symbols directive
+(available on recent versions of Darwin),
+we have to make sure that there is some kind of reference
+from the entry code to a label on the _top_ of of the info table,
+so that the linker will not think it is unreferenced and dead-strip
+it. That's why the label is called a DeadStripPreventer (_dsp).
+
+The LLVM code gen already creates `iTableSuf` symbols, where
+the X86 would generate the DeadStripPreventer (_dsp) symbol.
+Therefore all that is left for llvm code gen, is to ensure
+that all the `iTableSuf` symbols are marked as used.
+As of this writing the documentation regarding the
+.subsections_via_symbols and -dead_stip can be found at
+<https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html#//apple_ref/doc/uid/TP30000823-TPXREF101> \ No newline at end of file