aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/configure
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.3/gcc/configure')
-rwxr-xr-xgcc-4.4.3/gcc/configure100
1 files changed, 96 insertions, 4 deletions
diff --git a/gcc-4.4.3/gcc/configure b/gcc-4.4.3/gcc/configure
index 51db4d2b8..8e79dc560 100755
--- a/gcc-4.4.3/gcc/configure
+++ b/gcc-4.4.3/gcc/configure
@@ -12968,6 +12968,7 @@ fi
# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
CFLAGS="$saved_CFLAGS"
+# Check if .init_array can be used with .ctors.
# Check whether --enable-initfini-array or --disable-initfini-array was given.
if test "${enable_initfini_array+set}" = set; then
enableval="$enable_initfini_array"
@@ -12979,6 +12980,7 @@ echo $ECHO_N "checking for .preinit_array/.init_array/.fini_array support... $EC
if test "${gcc_cv_initfini_array+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
+ if test "x${build}" = "x${target}" ; then
if test "$cross_compiling" = yes; then
gcc_cv_initfini_array=no
else
@@ -12989,10 +12991,97 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-static int x = -1;
-int main (void) { return x; }
-int foo (void) { x = 0; }
-int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
+extern void abort ();
+static int count;
+
+static void
+init1005 ()
+{
+ if (count != 0)
+ abort ();
+ count = 1005;
+}
+void (*const init_array1005) ()
+ __attribute__ ((section (".init_array.01005"), aligned (sizeof (void *))))
+ = { init1005 };
+static void
+fini1005 ()
+{
+ if (count != 1005)
+ abort ();
+}
+void (*const fini_array1005) ()
+ __attribute__ ((section (".fini_array.01005"), aligned (sizeof (void *))))
+ = { fini1005 };
+
+static void
+ctor1007 ()
+{
+ if (count != 1005)
+ abort ();
+ count = 1007;
+}
+void (*const ctors1007) ()
+ __attribute__ ((section (".ctors.64528"), aligned (sizeof (void *))))
+ = { ctor1007 };
+static void
+dtor1007 ()
+{
+ if (count != 1007)
+ abort ();
+ count = 1005;
+}
+void (*const dtors1007) ()
+ __attribute__ ((section (".dtors.64528"), aligned (sizeof (void *))))
+ = { dtor1007 };
+
+static void
+init65530 ()
+{
+ if (count != 1007)
+ abort ();
+ count = 65530;
+}
+void (*const init_array65530) ()
+ __attribute__ ((section (".init_array.65530"), aligned (sizeof (void *))))
+ = { init65530 };
+static void
+fini65530 ()
+{
+ if (count != 65530)
+ abort ();
+ count = 1007;
+}
+void (*const fini_array65530) ()
+ __attribute__ ((section (".fini_array.65530"), aligned (sizeof (void *))))
+ = { fini65530 };
+
+static void
+ctor65535 ()
+{
+ if (count != 65530)
+ abort ();
+ count = 65535;
+}
+void (*const ctors65535) ()
+ __attribute__ ((section (".ctors"), aligned (sizeof (void *))))
+ = { ctor65535 };
+static void
+dtor65535 ()
+{
+ if (count != 65535)
+ abort ();
+ count = 65530;
+}
+void (*const dtors65535) ()
+ __attribute__ ((section (".dtors"), aligned (sizeof (void *))))
+ = { dtor65535 };
+
+int
+main ()
+{
+ return 0;
+}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -13016,6 +13105,9 @@ gcc_cv_initfini_array=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+ else
+ gcc_cv_initfini_array=no
+ fi
fi
echo "$as_me:$LINENO: result: $gcc_cv_initfini_array" >&5
echo "${ECHO_T}$gcc_cv_initfini_array" >&6