aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.3/gcc/configure.ac')
-rw-r--r--gcc-4.4.3/gcc/configure.ac110
1 files changed, 109 insertions, 1 deletions
diff --git a/gcc-4.4.3/gcc/configure.ac b/gcc-4.4.3/gcc/configure.ac
index 1ee190a76..e83b6cad5 100644
--- a/gcc-4.4.3/gcc/configure.ac
+++ b/gcc-4.4.3/gcc/configure.ac
@@ -1184,7 +1184,115 @@ fi
# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
CFLAGS="$saved_CFLAGS"
-gcc_AC_INITFINI_ARRAY
+# Check if .init_array can be used with .ctors.
+AC_ARG_ENABLE(initfini-array,
+ [ --enable-initfini-array use .init_array/.fini_array sections],
+ [], [
+AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
+ gcc_cv_initfini_array, [dnl
+ if test "x${build}" = "x${target}" ; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([
+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;
+}])],
+ [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
+ [gcc_cv_initfini_array=no])
+ else
+ gcc_cv_initfini_array=no
+ enable_initfini_array=$gcc_cv_initfini_array
+])
+if test $enable_initfini_array = yes; then
+ AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
+ [Define .init_array/.fini_array sections are available and working.])
+fi
# mkdir takes a single argument on some systems.
gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG