[commit: ghc] master: Add warning comment about Mach-O section name hack. (b647700)

git at git.haskell.org git at git.haskell.org
Tue Sep 17 09:55:57 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b6477001fce89ecd4c3e61cb76440ac43e069c95/ghc

>---------------------------------------------------------------

commit b6477001fce89ecd4c3e61cb76440ac43e069c95
Author: Edward Z. Yang <ezyang at mit.edu>
Date:   Tue Sep 17 00:55:46 2013 -0700

    Add warning comment about Mach-O section name hack.
    
    Signed-off-by: Edward Z. Yang <ezyang at mit.edu>


>---------------------------------------------------------------

b6477001fce89ecd4c3e61cb76440ac43e069c95
 rts/Linker.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rts/Linker.c b/rts/Linker.c
index 4f85498..58cfca6 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -6709,6 +6709,11 @@ static int ocRunInit_MachO ( ObjectCode *oc )
     getProgEnvv(&envc, &envv);
 
     for (i = 0; i < segLC->nsects; i++) {
+        // ToDo: replace this with a proper check for the S_MOD_INIT_FUNC_POINTERS
+        // flag.  We should do this elsewhere in the Mach-O linker code
+        // too.  Note that the system linker will *refuse* to honor
+        // sections which don't have this flag, so this could cause
+        // weird behavior divergence (albeit reproduceable).
         if (0 == strcmp(sections[i].sectname,"__mod_init_func")) {
             char *init_startC = image + sections[i].offset;
             init_t *init = (init_t*)init_startC;




More information about the ghc-commits mailing list