mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
csu: Avoid weak ref for __ehdr_start in static PIE
All linkers support __ehdr_start that support static PIE linking, so there is no need to check for its presence via a weak reference. This avoids a RELATIVE relocation in static PIE startup code on some targets. With non-PIE static linking the weak ref check is kept in case the linker does not support __ehdr_start. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@ -175,8 +175,12 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
|
|||||||
information from auxv. */
|
information from auxv. */
|
||||||
|
|
||||||
extern const ElfW(Ehdr) __ehdr_start
|
extern const ElfW(Ehdr) __ehdr_start
|
||||||
|
# if BUILD_PIE_DEFAULT
|
||||||
|
__attribute__ ((visibility ("hidden")));
|
||||||
|
# else
|
||||||
__attribute__ ((weak, visibility ("hidden")));
|
__attribute__ ((weak, visibility ("hidden")));
|
||||||
if (&__ehdr_start != NULL)
|
if (&__ehdr_start != NULL)
|
||||||
|
# endif
|
||||||
{
|
{
|
||||||
assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr));
|
assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr));
|
||||||
GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff;
|
GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff;
|
||||||
|
Reference in New Issue
Block a user