[commit: testsuite] master: Implement assembly test for #5435 in Windows. (b3c5baa)

git at git.haskell.org git at git.haskell.org
Tue Sep 17 03:01:50 CEST 2013


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

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

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

commit b3c5baa2663b183a9b77a8daf10303a36b99bcc7
Author: Edward Z. Yang <ezyang at mit.edu>
Date:   Mon Sep 16 17:59:39 2013 -0700

    Implement assembly test for #5435 in Windows.
    
    Fixes HostOS bug, where the define was not being set.
    
    Signed-off-by: Edward Z. Yang <ezyang at mit.edu>


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

b3c5baa2663b183a9b77a8daf10303a36b99bcc7
 tests/rts/Makefile    |    4 ++--
 tests/rts/T5435_asm.c |    8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/rts/Makefile b/tests/rts/Makefile
index b621fcf..d506d3a 100644
--- a/tests/rts/Makefile
+++ b/tests/rts/Makefile
@@ -53,14 +53,14 @@ T5423:
 
 define run_T5435_v
 $(RM) T5435_load_v_$(1) T5435_v_$(1)$(exeext)
-'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -c T5435_$(1).c -o T5435_load_v_$(1).o
+'$(TEST_HC)' $(TEST_HC_OPTS) -optc-D$(HostOS)_HOST_OS=1 -v0 -c T5435_$(1).c -o T5435_load_v_$(1).o
 '$(TEST_HC)' $(TEST_HC_OPTS) -v0 T5435.hs -osuf main_v_$(1)_o -o T5435_v_$(1)$(exeext)
 ./T5435_v_$(1) v ./T5435_load_v_$(1).o
 endef
 
 define run_T5435_dyn
 $(RM) T5435_load_dyn_$(1) T5435_dyn_$(1)$(exeext)
-'$(TEST_HC)' $(filter-out -rtsopts, $(TEST_HC_OPTS)) -v0 -fPIC -shared -c T5435_$(1).c -osuf dyn_$(1)_o -o T5435_load_dyn_$(1)$(dllext)
+'$(TEST_HC)' $(filter-out -rtsopts, $(TEST_HC_OPTS)) -optc-D$(HostOS)_HOST_OS=1 -v0 -fPIC -shared -c T5435_$(1).c -osuf dyn_$(1)_o -o T5435_load_dyn_$(1)$(dllext)
 '$(TEST_HC)' $(TEST_HC_OPTS) -v0 T5435.hs -osuf main_dyn_$(1)_o -o T5435_dyn_$(1)$(exeext)
 ./T5435_dyn_$(1) dyn ./T5435_load_dyn_$(1)$(dllext)
 endef
diff --git a/tests/rts/T5435_asm.c b/tests/rts/T5435_asm.c
index 125da9e..68fdf84 100644
--- a/tests/rts/T5435_asm.c
+++ b/tests/rts/T5435_asm.c
@@ -9,9 +9,13 @@ 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); }
 
-#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
+#if defined(cygwin32_HOST_OS) || defined(mingw32_HOST_OS)
 
-#error "Not implemented yet!"
+static void (*ctors[2])(void) __attribute__((
+            section(".ctors"),
+            used,
+            aligned(sizeof(void*))))
+    = {ctors2, ctors1}; // ctors run in reverse
 
 #elif defined(darwin_HOST_OS)
 




More information about the ghc-commits mailing list