about summary refs log tree commit diff
path: root/elf/dl-minimal-malloc.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-11-16 15:58:16 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-11-16 16:03:31 -0300
commitd8c2e8e0439b715918ee69b70aab4d222c17e2ca (patch)
treeeb4d583d04ce7e69cc8f8d2a1255c63d71683382 /elf/dl-minimal-malloc.c
parent1f67d8286b5da9266a138198ef1f15c27cbb0010 (diff)
downloadglibc-d8c2e8e0439b715918ee69b70aab4d222c17e2ca.tar.gz
glibc-d8c2e8e0439b715918ee69b70aab4d222c17e2ca.tar.xz
glibc-d8c2e8e0439b715918ee69b70aab4d222c17e2ca.zip
elf: hidden visibility for __minimal_malloc functions
Since b05fae4d8e34, __minimal malloc code is used during static
startup before PIE self-relocation (_dl_relocate_static_pie).
So it requires the same fix done for other objects by 47618209d05a.

Checked on aarch64, x86_64, and i686 with and without static-pie.
Diffstat (limited to 'elf/dl-minimal-malloc.c')
-rw-r--r--elf/dl-minimal-malloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/elf/dl-minimal-malloc.c b/elf/dl-minimal-malloc.c
index 939b5271ca..ea9bca26cf 100644
--- a/elf/dl-minimal-malloc.c
+++ b/elf/dl-minimal-malloc.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+/* Mark symbols hidden in static PIE for early self relocation to work.
+    Note: string.h may have ifuncs which cannot be hidden on i686.  */
+#if BUILD_PIE_DEFAULT
+# pragma GCC visibility push(hidden)
+#endif
 #include <assert.h>
 #include <string.h>
 #include <ldsodefs.h>