[MLton-commit] r6678

Wesley Terpstra wesley at mlton.org
Wed Jul 30 01:22:47 PDT 2008


In shared libraries, there is no _start.

Also, at least for linux, _init seems to be earlier in the text segment 
than _start. _init must also exist on all ELF systems. It might be desirable
to use _init always instead of _start, but I don't know how this would
affect other platforms. It might not always come first there.


----------------------------------------------------------------------

U   mlton/trunk/runtime/platform/getText.c

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/platform/getText.c
===================================================================
--- mlton/trunk/runtime/platform/getText.c	2008-07-30 08:18:01 UTC (rev 6677)
+++ mlton/trunk/runtime/platform/getText.c	2008-07-30 08:22:41 UTC (rev 6678)
@@ -1,9 +1,17 @@
 /* To get the beginning and end of the text segment. */
-extern unsigned char _start;
-extern unsigned char etext;
+#if defined(PIC)
+INTERNAL extern unsigned char _init;
+#else
+INTERNAL extern unsigned char _start;
+#endif
+INTERNAL extern unsigned char etext;
 
 code_pointer GC_getTextStart (void) {
+#if defined(PIC)
+        return &_init;
+#else
         return &_start;
+#endif
 }
 
 code_pointer GC_getTextEnd (void) {




More information about the MLton-commit mailing list