aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-12-20 15:52:57 +0100
committerFlorian Weimer <fweimer@redhat.com>2024-12-20 15:52:57 +0100
commit2b1dba3eb364aa65ce4ee947c39fb8d2d75e69b5 (patch)
tree0036fd9611c8a9cda941c72ef80d16201380e24d /sysdeps/generic
parent322e9d4e443084336ea41a8e7bf72456ab273b73 (diff)
downloadglibc-2b1dba3eb364aa65ce4ee947c39fb8d2d75e69b5.tar.xz
glibc-2b1dba3eb364aa65ce4ee947c39fb8d2d75e69b5.zip
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>
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/ldsodefs.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 384640b734..2c25c8db46 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -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)
{