summary refs log tree commit diff
path: root/configure.in
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-03-08 00:17:27 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-03-08 00:17:27 +0000
commit07037eeb43ca1e0ac2802e3a1492cecf869c63c6 (patch)
tree83e74c69cd8497be987abe3e2e058fb3a62cb278 /configure.in
parentaf6a1e37554a1245d468ffe44d2c981998a4e0eb (diff)
downloadglibc-07037eeb43ca1e0ac2802e3a1492cecf869c63c6.tar.gz
glibc-07037eeb43ca1e0ac2802e3a1492cecf869c63c6.tar.xz
glibc-07037eeb43ca1e0ac2802e3a1492cecf869c63c6.zip
Fix .ctors/.dtors header configure test for bootstrapping.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in25
1 files changed, 9 insertions, 16 deletions
diff --git a/configure.in b/configure.in
index 7ebeba4df8..ee9e3d8eb4 100644
--- a/configure.in
+++ b/configure.in
@@ -1349,24 +1349,17 @@ fi
 
 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
 	       libc_cv_initfini_array, [dnl
-cat > conftest.c <<EOF
-int _start (void) { return 0; }
-int __start (void) { return 0; }
+LIBC_TRY_LINK_STATIC([
 int foo (void) { return 1; }
 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
-EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
-		   -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
-then
-  if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
+],
+  [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
     libc_cv_initfini_array=yes
   else
     libc_cv_initfini_array=no
-  fi
-else
-  libc_cv_initfini_array=no
-fi
-rm -f conftest*])
+  fi],
+  [libc_cv_initfini_array=no])
+])
 if test $libc_cv_initfini_array != yes; then
   AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
 fi
@@ -1374,9 +1367,9 @@ fi
 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
 	       libc_cv_ctors_header, [dnl
   libc_cv_ctors_header=yes
-  AC_TRY_LINK([], [
-__attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
-__attribute__ ((destructor))  void dtor (void) { puts("dtor"); }
+  LIBC_TRY_LINK_STATIC([
+__attribute__ ((constructor)) void ctor (void) { asm (""); }
+__attribute__ ((destructor))  void dtor (void) { asm (""); }
 ],
 	      [dnl
       AS_IF([$READELF -WS conftest$ac_exeext | $AWK '