[commit: testsuite] master: Finish up asm test #5435 for Mac OS X (28e921b)

git at git.haskell.org git at git.haskell.org
Tue Sep 17 09:51:30 CEST 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/28e921b2954ef0afe08c9f96d779fb845e513421/testsuite

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

commit 28e921b2954ef0afe08c9f96d779fb845e513421
Author: Edward Z. Yang <ezyang at mit.edu>
Date:   Tue Sep 17 00:02:45 2013 -0700

    Finish up asm test #5435 for Mac OS X
    
    Signed-off-by: Edward Z. Yang <ezyang at mit.edu>


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

28e921b2954ef0afe08c9f96d779fb845e513421
 tests/rts/T5435_asm.c                 |   20 +++++++++++++++-----
 tests/rts/T5435_dyn_asm.stdout-darwin |    3 +++
 tests/rts/T5435_v_asm.stdout-darwin   |    3 +++
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/tests/rts/T5435_asm.c b/tests/rts/T5435_asm.c
index 68fdf84..423c6fd 100644
--- a/tests/rts/T5435_asm.c
+++ b/tests/rts/T5435_asm.c
@@ -4,10 +4,12 @@
 //      (1) if we segfault, we'll see the output
 //      (2) we get ordered correctly with Haskell output, which uses
 //          different buffers
-static void initArray1(void) { printf("initArray1\n"); fflush(stdout); }
-static void initArray2(void) { printf("initArray2\n"); fflush(stdout); }
-static void ctors1(void)     { printf("ctors1\n");     fflush(stdout); }
-static void ctors2(void)     { printf("ctors2\n");     fflush(stdout); }
+static void initArray1(void)    { printf("initArray1\n");   fflush(stdout); }
+static void initArray2(void)    { printf("initArray2\n");   fflush(stdout); }
+static void ctors1(void)        { printf("ctors1\n");       fflush(stdout); }
+static void ctors2(void)        { printf("ctors2\n");       fflush(stdout); }
+static void modInitFunc1(void)  { printf("modInitFunc1\n"); fflush(stdout); }
+static void modInitFunc2(void)  { printf("modInitFunc2\n"); fflush(stdout); }
 
 #if defined(cygwin32_HOST_OS) || defined(mingw32_HOST_OS)
 
@@ -19,7 +21,15 @@ static void (*ctors[2])(void) __attribute__((
 
 #elif defined(darwin_HOST_OS)
 
-#error "Not implemented yet!"
+static void (*mod_init_func[2])(void) __attribute__((
+            // Mac OS X sections are in two parts: the segment name and
+            // the section name.  The third part is the flag which says
+            // that this section is a list of module initialization
+            // functions.
+            section("__DATA,__mod_init_func,mod_init_funcs"),
+            used,
+            aligned(sizeof(void*))))
+    = {modInitFunc1, modInitFunc2};
 
 #else /* ELF */
 
diff --git a/tests/rts/T5435_dyn_asm.stdout-darwin b/tests/rts/T5435_dyn_asm.stdout-darwin
new file mode 100644
index 0000000..8827792
--- /dev/null
+++ b/tests/rts/T5435_dyn_asm.stdout-darwin
@@ -0,0 +1,3 @@
+modInitFunc1
+modInitFunc2
+success
diff --git a/tests/rts/T5435_v_asm.stdout-darwin b/tests/rts/T5435_v_asm.stdout-darwin
new file mode 100644
index 0000000..8827792
--- /dev/null
+++ b/tests/rts/T5435_v_asm.stdout-darwin
@@ -0,0 +1,3 @@
+modInitFunc1
+modInitFunc2
+success




More information about the ghc-commits mailing list