1
0
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:
Florian Weimer
2024-12-20 15:52:57 +01:00
parent 322e9d4e44
commit 2b1dba3eb3
10 changed files with 28 additions and 56 deletions

View File

@ -284,7 +284,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
if (__glibc_unlikely (r_type == R_SH_RELATIVE))
{
#ifndef RTLD_BOOTSTRAP
if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
if (is_rtld_link_map (map)) /* Already done in rtld itself. */
#endif
{
if (reloc->r_addend)
@ -380,16 +380,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
case R_SH_DIR32:
{
#if !defined RTLD_BOOTSTRAP
/* 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. */
# ifndef SHARED
weak_extern (_dl_rtld_map);
# endif
if (map == &GL(dl_rtld_map))
if (is_rtld_link_map (map))
/* Undo the relocation done here during bootstrapping.
Now we will relocate it anew, possibly using a
binding found in the user program or a loaded library