aboutsummaryrefslogtreecommitdiff
path: root/newlib/configure.in
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2005-01-07 18:04:39 +0000
committerJeff Johnston <jjohnstn@redhat.com>2005-01-07 18:04:39 +0000
commitf7a74742e69119d7133c8d9619ae94175faed068 (patch)
tree526a24a1f892045b2e52bec5a0ee8ba743ee32be /newlib/configure.in
parent35310094a18515e7b0be818abbff262f6718f849 (diff)
downloadnewlib-f7a74742e69119d7133c8d9619ae94175faed068.zip
newlib-f7a74742e69119d7133c8d9619ae94175faed068.tar.gz
newlib-f7a74742e69119d7133c8d9619ae94175faed068.tar.bz2
2005-01-07 Paul Brook <paul@codesourcery.com>
* configure.in: Add test for .init_array. * configure: Regenerate. * newlib.hin: Add HAVE_INITFINI_ARRAY. * libc/misc/Makefile.am: Add init.c * libc/misc/Makefile.in: Regenerate. * libc/misc/init.c: New file. * libc/sys/arm/crt0.S: Call __libc_{init,fini}_array instead of _init/_fini if they exist.
Diffstat (limited to 'newlib/configure.in')
-rw-r--r--newlib/configure.in25
1 files changed, 25 insertions, 0 deletions
diff --git a/newlib/configure.in b/newlib/configure.in
index dbc4cb5..d666136 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -329,6 +329,31 @@ if test "x${iconv_encodings}" != "x" \
done
fi;
+AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
+ libc_cv_initfinit_array, [dnl
+cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) { return 1; }
+int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
+EOF
+if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
+ -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
+then
+ if readelf -S conftest | grep -e INIT_ARRAY > /dev/null; then
+ libc_cv_initfinit_array=yes
+ else
+ libc_cv_initfinit_array=no
+ fi
+else
+ libc_cv_initfinit_array=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_initfinit_array)
+if test $libc_cv_initfinit_array = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY)
+fi
+
AC_OUTPUT(Makefile,
[if test -n "$CONFIG_FILES"; then
unset ac_file