aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-05-19 01:50:40 +0000
committerRichard Stallman <rms@gnu.org>1992-05-19 01:50:40 +0000
commit91141d4f140e2f5dbe09e1088f9db930a3e49e89 (patch)
tree77ccaa4253a407c3dc69f6c63cc2b89f79e46324 /gcc
parentc3f3d7e145df868a9c362cf0583948ec76bf6ac1 (diff)
downloadgcc-91141d4f140e2f5dbe09e1088f9db930a3e49e89.zip
gcc-91141d4f140e2f5dbe09e1088f9db930a3e49e89.tar.gz
gcc-91141d4f140e2f5dbe09e1088f9db930a3e49e89.tar.bz2
*** empty log message ***
From-SVN: r1013
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/svr3.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h
index 9d70cbf..ffaac52 100644
--- a/gcc/config/svr3.h
+++ b/gcc/config/svr3.h
@@ -216,13 +216,32 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
because they push on the stack. */
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *__CTOR_LIST__ = __builtin_alloca (0), *p; \
- for (p = __CTOR_LIST__; *p; ) \
- (*p++) (); \
+#ifdef STACK_GROWS_DOWNWARD
+
+/* Constructor list on stack is in reverse order. Go to the end of the
+ list and go backwards to call constructors in the right order. */
+#define DO_GLOBAL_CTORS_BODY \
+do { \
+ func_ptr *p, *beg = alloca (0); \
+ for (p = beg; *p; p++) \
+ ; \
+ while (p != beg) \
+ (*--p) (); \
} while (0)
+#else
+
+/* Constructor list on stack is in correct order. Just call them. */
+#define DO_GLOBAL_CTORS_BODY \
+do { \
+ func_ptr *p, *beg = alloca (0); \
+ for (p = beg; *p; ) \
+ (*p++) (); \
+#endif \
+} while (0)
+
+#endif /* STACK_GROWS_DOWNWARD */
+
/* Add extra sections .init and .fini, in addition to .bss from att386.h. */
#undef EXTRA_SECTIONS