mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
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).
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2014-08-12 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* configure.ac: Change __ehdr_start code to dereference the struct.
|
||||||
|
Run readelf on the output to look for relocations.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
2014-08-12 Joseph Myers <joseph@codesourcery.com>
|
2014-08-12 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
[BZ #17261]
|
[BZ #17261]
|
||||||
|
26
configure
vendored
26
configure
vendored
@ -6965,8 +6965,11 @@ if test $libc_cv_predef_stack_protector = yes; then
|
|||||||
fi
|
fi
|
||||||
libc_extra_cppflags=
|
libc_extra_cppflags=
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker provides __ehdr_start" >&5
|
# Some linkers on some architectures support __ehdr_start but with
|
||||||
$as_echo_n "checking whether the linker provides __ehdr_start... " >&6; }
|
# 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 :
|
if ${libc_cv_ehdr_start+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
@ -6980,12 +6983,20 @@ LIBS=
|
|||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
extern const char __ehdr_start __attribute__ ((visibility ("hidden")));
|
typedef struct {
|
||||||
const char *ehdr (void) { return &__ehdr_start; }
|
char foo;
|
||||||
|
long val;
|
||||||
|
} Ehdr;
|
||||||
|
extern const Ehdr __ehdr_start __attribute__ ((visibility ("hidden")));
|
||||||
|
long ehdr (void) { return __ehdr_start.val; }
|
||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
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
|
else
|
||||||
libc_cv_ehdr_start=no
|
libc_cv_ehdr_start=no
|
||||||
fi
|
fi
|
||||||
@ -6998,9 +7009,12 @@ LIBS="$old_LIBS"
|
|||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ehdr_start" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ehdr_start" >&5
|
||||||
$as_echo "$libc_cv_ehdr_start" >&6; }
|
$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
|
$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
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_trap with no external dependencies" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_trap with no external dependencies" >&5
|
||||||
|
23
configure.ac
23
configure.ac
@ -1880,7 +1880,10 @@ if test $libc_cv_predef_stack_protector = yes; then
|
|||||||
fi
|
fi
|
||||||
libc_extra_cppflags=
|
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, [
|
libc_cv_ehdr_start, [
|
||||||
old_CFLAGS="$CFLAGS"
|
old_CFLAGS="$CFLAGS"
|
||||||
old_LDFLAGS="$LDFLAGS"
|
old_LDFLAGS="$LDFLAGS"
|
||||||
@ -1889,16 +1892,26 @@ CFLAGS="$CFLAGS -fPIC"
|
|||||||
LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
|
LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
|
||||||
LIBS=
|
LIBS=
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||||
extern const char __ehdr_start __attribute__ ((visibility ("hidden")));
|
typedef struct {
|
||||||
const char *ehdr (void) { return &__ehdr_start; }
|
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"
|
CFLAGS="$old_CFLAGS"
|
||||||
LDFLAGS="$old_LDFLAGS"
|
LDFLAGS="$old_LDFLAGS"
|
||||||
LIBS="$old_LIBS"
|
LIBS="$old_LIBS"
|
||||||
])
|
])
|
||||||
if test $libc_cv_ehdr_start = yes; then
|
if test "$libc_cv_ehdr_start" = yes; then
|
||||||
AC_DEFINE([HAVE_EHDR_START])
|
AC_DEFINE([HAVE_EHDR_START])
|
||||||
|
elif test "$libc_cv_ehdr_start" = broken; then
|
||||||
|
AC_MSG_WARN([linker is broken -- you should upgrade])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
|
AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
|
||||||
|
Reference in New Issue
Block a user