glibc/v2-0013-elf-Always-provide-_dl_get_dl_main_map-in-libc.a.patch

60 lines
1.8 KiB
Diff
Raw Normal View History

From dfb1d9949aca739933464bde8710375358536047 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 14 Jan 2022 06:04:25 -0800
Subject: [PATCH v2 13/15] elf: Always provide _dl_get_dl_main_map in libc.a
Always provide _dl_get_dl_main_map in libc.a. It will be used by x86
to process PT_GNU_PROPERTY segment.
---
elf/dl-support.c | 2 --
sysdeps/generic/ldsodefs.h | 8 ++++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 322599916f..042be8a433 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -353,7 +353,6 @@ _dl_non_dynamic_init (void)
DL_SYSINFO_IMPLEMENTATION
#endif
-#if ENABLE_STATIC_PIE
/* Since relocation to hidden _dl_main_map causes relocation overflow on
aarch64, a function is used to get the address of _dl_main_map. */
@@ -362,7 +361,6 @@ _dl_get_dl_main_map (void)
{
return &_dl_main_map;
}
-#endif
/* This is used by _dl_runtime_profile, not used on static code. */
void
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index ba53176296..7a0903cb8a 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1172,15 +1172,15 @@ void __libc_setup_tls (void);
# if ENABLE_STATIC_PIE
/* Relocate static executable with PIE. */
extern void _dl_relocate_static_pie (void) attribute_hidden;
-
-/* Get a pointer to _dl_main_map. */
-extern struct link_map * _dl_get_dl_main_map (void)
- __attribute__ ((visibility ("hidden")));
# else
# define _dl_relocate_static_pie()
# endif
#endif
+/* Get a pointer to _dl_main_map. */
+extern struct link_map * _dl_get_dl_main_map (void)
+ __attribute__ ((visibility ("hidden")));
+
/* Perform early memory allocation, avoiding a TCB dependency.
Terminate the process if allocation fails. May attempt to use
brk. */
--
2.40.1