diff options
author | Roland McGrath <roland@hack.frob.com> | 2011-06-11 05:14:37 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2011-07-14 20:50:18 -0700 |
commit | fd5e21c75d8e9221d766f4bc922a237265514ec2 (patch) | |
tree | 71751682113629df33d174e174e077666366e1e3 /configure.in | |
parent | 5c55070081c27168d27145afdf6a92cd56c9abb3 (diff) | |
download | glibc-fd5e21c75d8e9221d766f4bc922a237265514ec2.zip glibc-fd5e21c75d8e9221d766f4bc922a237265514ec2.tar.gz glibc-fd5e21c75d8e9221d766f4bc922a237265514ec2.tar.bz2 |
Default to --with-default-link=yes if configure check finds good -shared layout.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/configure.in b/configure.in index a28cd70..65ace27 100644 --- a/configure.in +++ b/configure.in @@ -117,10 +117,9 @@ AC_ARG_WITH([headers], AC_SUBST(use_default_link) AC_ARG_WITH([default-link], AC_HELP_STRING([--with-default-link], - [do not use explicit linker scripts - @<:@default=no@:>@]), + [do not use explicit linker scripts]), [use_default_link=$withval], - [use_default_link=no]) + [use_default_link=default]) AC_ARG_ENABLE([sanity-checks], AC_HELP_STRING([--disable-sanity-checks], @@ -1801,6 +1800,59 @@ EOF fi rm -f conftest*]) AC_SUBST(libc_cv_hashstyle) + + # The linker's default -shared behavior is good enough if it + # does these things that our custom linker scripts ensure that + # all allocated NOTE sections come first. + if test "$use_default_link" = default; then + AC_CACHE_CHECK([for sufficient default -shared layout], + libc_cv_use_default_link, [dnl + libc_cv_use_default_link=no + cat > conftest.s <<\EOF + .section .note.a,"a",%note + .balign 4 + .long 4,4,9 + .string "GNU" + .string "foo" + .section .note.b,"a",%note + .balign 4 + .long 4,4,9 + .string "GNU" + .string "bar" +EOF + if AC_TRY_COMMAND([dnl + ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) && + ac_try=`$READELF -S conftest.so | sed -n \ + ['${x;p;} + s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/ + t a + b + : a + H']` + then + libc_seen_a=no libc_seen_b=no + set -- $ac_try + while test $# -ge 2 -a "$1" = NOTE; do + case "$2" in + .note.a) libc_seen_a=yes ;; + .note.b) libc_seen_b=yes ;; + esac + shift 2 + done + case "$libc_seen_a$libc_seen_b" in + yesyes) + libc_cv_use_default_link=yes + ;; + *) + echo >&AS_MESSAGE_LOG_FD "\ +$libc_seen_a$libc_seen_b from: +$ac_try" + ;; + esac + fi + rm -f conftest*]) + use_default_link=$libc_cv_use_default_link + fi fi AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl |