Fix .ctors/.dtors header configure test for bootstrapping.
This commit is contained in:
parent
af6a1e3755
commit
07037eeb43
|
@ -1,3 +1,11 @@
|
||||||
|
2012-03-08 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* aclocal.m4 (LIBC_TRY_LINK_STATIC): New macro.
|
||||||
|
* configure.in (libc_cv_preinit_array): Use LIBC_TRY_LINK_STATIC.
|
||||||
|
(libc_cv_ctors_header): Likewise. Use asm ("") instead of calling
|
||||||
|
puts.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
2012-03-07 Joseph Myers <joseph@codesourcery.com>
|
2012-03-07 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* sysdeps/i386/configure.in (cpuid.h): Use AC_CHECK_HEADER with no
|
* sysdeps/i386/configure.in (cpuid.h): Use AC_CHECK_HEADER with no
|
||||||
|
|
14
aclocal.m4
vendored
14
aclocal.m4
vendored
|
@ -113,3 +113,17 @@ AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
|
||||||
[LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
|
[LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
|
||||||
gnu_ld=$libc_cv_prog_ld_gnu
|
gnu_ld=$libc_cv_prog_ld_gnu
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl Run a static link test with -nostdlib -nostartfiles.
|
||||||
|
dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
|
||||||
|
AC_DEFUN([LIBC_TRY_LINK_STATIC],
|
||||||
|
[cat > conftest.c <<EOF
|
||||||
|
int _start (void) { return 0; }
|
||||||
|
int __start (void) { return 0; }
|
||||||
|
$1
|
||||||
|
EOF
|
||||||
|
AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
|
||||||
|
conftest.c -static -nostartfiles -nostdlib
|
||||||
|
1>&AS_MESSAGE_LOG_FD])],
|
||||||
|
[$2], [$3])
|
||||||
|
rm -f conftest*])
|
||||||
|
|
41
configure
vendored
41
configure
vendored
|
@ -5999,17 +5999,19 @@ else
|
||||||
cat > conftest.c <<EOF
|
cat > conftest.c <<EOF
|
||||||
int _start (void) { return 0; }
|
int _start (void) { return 0; }
|
||||||
int __start (void) { return 0; }
|
int __start (void) { return 0; }
|
||||||
|
|
||||||
int foo (void) { return 1; }
|
int foo (void) { return 1; }
|
||||||
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
|
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
|
||||||
-static -nostartfiles -nostdlib 1>&5'
|
conftest.c -static -nostartfiles -nostdlib
|
||||||
|
1>&5'
|
||||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
(eval $ac_try) 2>&5
|
(eval $ac_try) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; }
|
test $ac_status = 0; }; }; then :
|
||||||
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
|
libc_cv_initfini_array=yes
|
||||||
else
|
else
|
||||||
|
@ -6019,6 +6021,7 @@ else
|
||||||
libc_cv_initfini_array=no
|
libc_cv_initfini_array=no
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_initfini_array" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_initfini_array" >&5
|
||||||
$as_echo "$libc_cv_initfini_array" >&6; }
|
$as_echo "$libc_cv_initfini_array" >&6; }
|
||||||
|
@ -6032,21 +6035,22 @@ if ${libc_cv_ctors_header+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
libc_cv_ctors_header=yes
|
libc_cv_ctors_header=yes
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat > conftest.c <<EOF
|
||||||
/* end confdefs.h. */
|
int _start (void) { return 0; }
|
||||||
|
int __start (void) { return 0; }
|
||||||
|
|
||||||
int
|
__attribute__ ((constructor)) void ctor (void) { asm (""); }
|
||||||
main ()
|
__attribute__ ((destructor)) void dtor (void) { asm (""); }
|
||||||
{
|
|
||||||
|
|
||||||
__attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
|
EOF
|
||||||
__attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
|
||||||
|
conftest.c -static -nostartfiles -nostdlib
|
||||||
;
|
1>&5'
|
||||||
return 0;
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
}
|
(eval $ac_try) 2>&5
|
||||||
_ACEOF
|
ac_status=$?
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; }; then :
|
||||||
if $READELF -WS conftest$ac_exeext | $AWK '
|
if $READELF -WS conftest$ac_exeext | $AWK '
|
||||||
{ gsub(/\[ */, "[") }
|
{ gsub(/\[ */, "[") }
|
||||||
$2 == ".ctors" || $2 == ".dtors" {
|
$2 == ".ctors" || $2 == ".dtors" {
|
||||||
|
@ -6068,8 +6072,7 @@ else
|
||||||
as_fn_error $? "missing __attribute__ ((constructor)) support??" "$LINENO" 5
|
as_fn_error $? "missing __attribute__ ((constructor)) support??" "$LINENO" 5
|
||||||
|
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f conftest*
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ctors_header" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ctors_header" >&5
|
||||||
|
|
25
configure.in
25
configure.in
|
@ -1349,24 +1349,17 @@ fi
|
||||||
|
|
||||||
AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
|
AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
|
||||||
libc_cv_initfini_array, [dnl
|
libc_cv_initfini_array, [dnl
|
||||||
cat > conftest.c <<EOF
|
LIBC_TRY_LINK_STATIC([
|
||||||
int _start (void) { return 0; }
|
|
||||||
int __start (void) { return 0; }
|
|
||||||
int foo (void) { return 1; }
|
int foo (void) { return 1; }
|
||||||
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
|
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
|
||||||
EOF
|
],
|
||||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
|
[if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
|
||||||
-static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
|
|
||||||
then
|
|
||||||
if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
|
|
||||||
libc_cv_initfini_array=yes
|
libc_cv_initfini_array=yes
|
||||||
else
|
else
|
||||||
libc_cv_initfini_array=no
|
libc_cv_initfini_array=no
|
||||||
fi
|
fi],
|
||||||
else
|
[libc_cv_initfini_array=no])
|
||||||
libc_cv_initfini_array=no
|
])
|
||||||
fi
|
|
||||||
rm -f conftest*])
|
|
||||||
if test $libc_cv_initfini_array != yes; then
|
if test $libc_cv_initfini_array != yes; then
|
||||||
AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
|
AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
|
||||||
fi
|
fi
|
||||||
|
@ -1374,9 +1367,9 @@ fi
|
||||||
AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
|
AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
|
||||||
libc_cv_ctors_header, [dnl
|
libc_cv_ctors_header, [dnl
|
||||||
libc_cv_ctors_header=yes
|
libc_cv_ctors_header=yes
|
||||||
AC_TRY_LINK([], [
|
LIBC_TRY_LINK_STATIC([
|
||||||
__attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
|
__attribute__ ((constructor)) void ctor (void) { asm (""); }
|
||||||
__attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
|
__attribute__ ((destructor)) void dtor (void) { asm (""); }
|
||||||
],
|
],
|
||||||
[dnl
|
[dnl
|
||||||
AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
|
AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
|
||||||
|
|
Loading…
Reference in a new issue