about summary refs log tree commit diff
path: root/configure
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
parent898c62f488e9c403bbb1a96d06c7a257b047fcbc (diff)
downloadglibc-61b1ef6e7cc4518cdadb808dfa78980cc15a63c3.tar.gz
glibc-61b1ef6e7cc4518cdadb808dfa78980cc15a63c3.tar.xz
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')
-rwxr-xr-xconfigure26
1 files changed, 20 insertions, 6 deletions
diff --git a/configure b/configure
index 646e0bc9af..86ba30774b 100755
--- a/configure
+++ b/configure
@@ -6965,8 +6965,11 @@ if test $libc_cv_predef_stack_protector = yes; then
 fi
 libc_extra_cppflags=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker provides __ehdr_start" >&5
-$as_echo_n "checking whether the linker provides __ehdr_start... " >&6; }
+# 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).
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker provides working __ehdr_start" >&5
+$as_echo_n "checking whether the linker provides working __ehdr_start... " >&6; }
 if ${libc_cv_ehdr_start+:} false; then :
   $as_echo_n "(cached) " >&6
 else
@@ -6980,12 +6983,20 @@ LIBS=
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-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; }
 
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  libc_cv_ehdr_start=yes
+  if $READELF -r conftest | fgrep __ehdr_start >/dev/null; then
+		  libc_cv_ehdr_start=broken
+		else
+		  libc_cv_ehdr_start=yes
+		fi
 else
   libc_cv_ehdr_start=no
 fi
@@ -6998,9 +7009,12 @@ LIBS="$old_LIBS"
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ehdr_start" >&5
 $as_echo "$libc_cv_ehdr_start" >&6; }
-if test $libc_cv_ehdr_start = yes; then
+if test "$libc_cv_ehdr_start" = yes; then
   $as_echo "#define HAVE_EHDR_START 1" >>confdefs.h
 
+elif test "$libc_cv_ehdr_start" = broken; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linker is broken -- you should upgrade" >&5
+$as_echo "$as_me: WARNING: linker is broken -- you should upgrade" >&2;}
 fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_trap with no external dependencies" >&5