mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
elf: Introduce is_rtld_link_map
Unconditionally define it to false for static builds. This avoids the awkward use of weak_extern for _dl_rtld_map in checks that cannot be possibly true on static builds. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@ -436,16 +436,6 @@ elf_machine_reloc (struct link_map *map, struct r_scope_elem *scope[],
|
||||
const unsigned long int r_type = ELFW(R_TYPE) (r_info);
|
||||
ElfW(Addr) *addr_field = (ElfW(Addr) *) reloc_addr;
|
||||
|
||||
#if !defined RTLD_BOOTSTRAP && !defined SHARED
|
||||
/* This is defined in rtld.c, but nowhere in the static libc.a;
|
||||
make the reference weak so static programs can still link. This
|
||||
declaration cannot be done when compiling rtld.c (i.e. #ifdef
|
||||
RTLD_BOOTSTRAP) because rtld.c contains the common defn for
|
||||
_dl_rtld_map, which is incompatible with a weak decl in the same
|
||||
file. */
|
||||
weak_extern (GL(dl_rtld_map));
|
||||
#endif
|
||||
|
||||
switch (r_type)
|
||||
{
|
||||
#if !defined (RTLD_BOOTSTRAP)
|
||||
@ -534,7 +524,7 @@ elf_machine_reloc (struct link_map *map, struct r_scope_elem *scope[],
|
||||
though it's not ABI compliant. Some day we should
|
||||
bite the bullet and stop doing this. */
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
if (map != &GL(dl_rtld_map))
|
||||
if (!is_rtld_link_map (map))
|
||||
#endif
|
||||
reloc_value += SYMBOL_ADDRESS (map, sym, true);
|
||||
}
|
||||
@ -553,7 +543,7 @@ elf_machine_reloc (struct link_map *map, struct r_scope_elem *scope[],
|
||||
}
|
||||
else
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
if (map != &GL(dl_rtld_map))
|
||||
if (!is_rtld_link_map (map))
|
||||
#endif
|
||||
reloc_value += map->l_addr;
|
||||
|
||||
@ -749,7 +739,7 @@ elf_machine_got_rel (struct link_map *map, struct r_scope_elem *scope[], int laz
|
||||
|
||||
n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
|
||||
/* The dynamic linker's local got entries have already been relocated. */
|
||||
if (map != &GL(dl_rtld_map))
|
||||
if (!is_rtld_link_map (map))
|
||||
{
|
||||
/* got[0] is reserved. got[1] is also reserved for the dynamic object
|
||||
generated by gnu ld. Skip these reserved entries from relocation. */
|
||||
|
Reference in New Issue
Block a user