diff options
Diffstat (limited to 'gcc/config/interix.h')
-rw-r--r-- | gcc/config/interix.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/config/interix.h b/gcc/config/interix.h index 0f203f3cf48..a815ab13eb0 100644 --- a/gcc/config/interix.h +++ b/gcc/config/interix.h @@ -1,6 +1,6 @@ /* Operating system specific defines to be used when targeting GCC for Interix - Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1999, 2002 Free Software Foundation, Inc. Donn Terry, Softway Systems, Inc. (donn@softway.com) Modified from code Contributed by Douglas B. Rupp (drupp@cs.washington.edu). @@ -104,3 +104,37 @@ for windows/multi thread */ #define WCHAR_UNSIGNED 1 #define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE_SIZE 16 + +/* Our strategy for finding global constructors is a bit different, although + not a lot. */ +#define DO_GLOBAL_CTORS_BODY \ +do { \ + int i; \ + unsigned long nptrs; \ + func_ptr *p; \ + asm( \ + " .section .ctor_head, \"rw\"\n" \ + "1:\n" \ + " .text \n" \ + ASM_LOAD_ADDR(1b,%0) \ + : "=r" (p) : : "cc"); \ + for (nptrs = 0; p[nptrs] != 0; nptrs++); \ + for (i = nptrs-1; i >= 0; i--) \ + p[i] (); \ +} while (0) + +#define DO_GLOBAL_DTORS_BODY \ +do { \ + func_ptr *p; \ + asm( \ + " .section .dtor_head, \"rw\"\n" \ + "1:\n" \ + " .text \n" \ + ASM_LOAD_ADDR(1b,%0) \ + : "=r" (p) : : "cc"); \ + while (*p) \ + { \ + p++; \ + (*(p-1)) (); \ + } \ +} while (0) |