1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42: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

@@ -1323,10 +1323,17 @@ rtld_active (void)
return GLRO(dl_init_all_dirs) != NULL;
}
/* Returns true of L is the link map of the dynamic linker itself. */
static inline bool
is_rtld_link_map (const struct link_map *l)
{
return l == &GL(dl_rtld_map);
}
static inline struct auditstate *
link_map_audit_state (struct link_map *l, size_t index)
{
if (l == &GL (dl_rtld_map))
if (is_rtld_link_map (l))
/* The auditstate array is stored separately. */
return &GL (dl_rtld_auditstate) [index];
else
@@ -1389,6 +1396,13 @@ void DL_ARCH_FIXUP_ATTRIBUTE _dl_audit_pltexit (struct link_map *l,
attribute_hidden;
#else /* !SHARED */
/* No special dynamic linker link map in static builds. */
static inline bool
is_rtld_link_map (const struct link_map *l)
{
return false;
}
static inline void
_dl_audit_objclose (struct link_map *l)
{