aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2014-08-06 23:44:29 -0400
committerMike Frysinger <vapier@gentoo.org>2014-08-12 19:54:02 -0400
commit61b1ef6e7cc4518cdadb808dfa78980cc15a63c3 (patch)
tree5ca04e8eb95d11b26b74bbaeea9226787bf7dbdd /configure.ac
parentFix powerpc-nofpu __fe_enabled_env and __fe_nonieee_env (bug 17261). (diff)
downloadglibc-61b1ef6e7cc4518cdadb808dfa78980cc15a63c3.tar.gz
glibc-61b1ef6e7cc4518cdadb808dfa78980cc15a63c3.tar.bz2
glibc-61b1ef6e7cc4518cdadb808dfa78980cc15a63c3.zip
detect broken linker handling of __ehdr_start
Older versions of ld on ia64 support __ehdr_start, but generate relocs when they shouldn't. This causes the ld.so to not run because it tries to resolve the __ehdr_start symbol (but it's not exported).
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac23
1 files changed, 18 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index e89faa0dfe..255339983a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1880,7 +1880,10 @@ if test $libc_cv_predef_stack_protector = yes; then
fi
libc_extra_cppflags=
-AC_CACHE_CHECK([whether the linker provides __ehdr_start],
+# Some linkers on some architectures support __ehdr_start but with
+# bugs. Make sure usage of it does not create relocations in the
+# output (as the linker should resolve them all for us).
+AC_CACHE_CHECK([whether the linker provides working __ehdr_start],
libc_cv_ehdr_start, [
old_CFLAGS="$CFLAGS"
old_LDFLAGS="$LDFLAGS"
@@ -1889,16 +1892,26 @@ CFLAGS="$CFLAGS -fPIC"
LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
LIBS=
AC_LINK_IFELSE([AC_LANG_SOURCE([
-extern const char __ehdr_start __attribute__ ((visibility ("hidden")));
-const char *ehdr (void) { return &__ehdr_start; }
+typedef struct {
+ char foo;
+ long val;
+} Ehdr;
+extern const Ehdr __ehdr_start __attribute__ ((visibility ("hidden")));
+long ehdr (void) { return __ehdr_start.val; }
])],
- [libc_cv_ehdr_start=yes], [libc_cv_ehdr_start=no])
+ [if $READELF -r conftest | fgrep __ehdr_start >/dev/null; then
+ libc_cv_ehdr_start=broken
+ else
+ libc_cv_ehdr_start=yes
+ fi], [libc_cv_ehdr_start=no])
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
LIBS="$old_LIBS"
])
-if test $libc_cv_ehdr_start = yes; then
+if test "$libc_cv_ehdr_start" = yes; then
AC_DEFINE([HAVE_EHDR_START])
+elif test "$libc_cv_ehdr_start" = broken; then
+ AC_MSG_WARN([linker is broken -- you should upgrade])
fi
AC_CACHE_CHECK(for __builtin_trap with no external dependencies,