diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-11-03 11:20:50 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-11-09 14:11:25 -0300 |
commit | b05fae4d8e34604a72ee36d2d3164391b76fcf0b (patch) | |
tree | a66b3f943d6b70b27326261fcb60063378e4c67f /elf/Makefile | |
parent | db6c4935fae6005d46af413b32aa92f4f6059dce (diff) | |
download | glibc-b05fae4d8e34604a72ee36d2d3164391b76fcf0b.zip glibc-b05fae4d8e34604a72ee36d2d3164391b76fcf0b.tar.gz glibc-b05fae4d8e34604a72ee36d2d3164391b76fcf0b.tar.bz2 |
elf: Use the minimal malloc on tunables_strdup
The rtld_malloc functions are moved to its own file so it can be
used on csu code. Also, the functiosn are renamed to __minimal_*
(since there are now used not only on loader code).
Using the __minimal_malloc on tunables_strdup() avoids potential
issues with sbrk() calls while processing the tunables (I see
sporadic elf/tst-dso-ordering9 on powerpc64le with different
tests failing due ASLR).
Also, using __minimal_malloc over plain mmap optimizes the memory
allocation on both static and dynamic case (since it will any unused
space in either the last page of data segments, avoiding mmap() call,
or from the previous mmap() call).
Checked on x86_64-linux-gnu, i686-linux-gnu, and powerpc64le-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'elf/Makefile')
-rw-r--r-- | elf/Makefile | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile index 41c1966..7200448 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -36,7 +36,7 @@ dl-routines = $(addprefix dl-,load lookup object reloc deps \ exception sort-maps lookup-direct \ call-libc-early-init write \ thread_gscope_wait tls_init_tp \ - debug-symbols) + debug-symbols minimal-malloc) ifeq (yes,$(use-ldconfig)) dl-routines += dl-cache endif @@ -75,6 +75,11 @@ CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-iteratephdr.c += $(uses-callbacks) +# Called during static library initialization, so turn stack-protection +# off for non-shared builds. +CFLAGS-dl-minimal-malloc.o = $(no-stack-protector) +CFLAGS-dl-minimal-malloc.op = $(no-stack-protector) + # On targets without __builtin_memset, rtld.c uses a hand-coded loop # in _dl_start. Make sure this isn't turned into a call to regular memset. ifeq (yes,$(have-loop-to-function)) |