about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2016-12-26 10:08:48 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-26 10:08:48 +0100
commit995635f95b707488c23bba07be8016c9682d4045 (patch)
tree4d3e953045cede87bf3f416f396c9a3bb210e0f3 /elf/Makefile
parent10c85e76c09716e744b4a41006718400b1eb2e84 (diff)
downloadglibc-995635f95b707488c23bba07be8016c9682d4045.tar.gz
glibc-995635f95b707488c23bba07be8016c9682d4045.tar.xz
glibc-995635f95b707488c23bba07be8016c9682d4045.zip
Compile the dynamic linker without stack protection [BZ #7065]
Also compile corresponding routines in the static libc.a with the same
flag.
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/elf/Makefile b/elf/Makefile
index cd26e16558..1e7d7240ef 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -51,6 +51,18 @@ CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
 
+# Compile rtld itself without stack protection.
+# Also compile all routines in the static library that are elided from
+# the shared libc because they are in libc.a in the same way.
+
+define elide-stack-protector
+$(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-stack-protector))
+endef
+
+CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
+CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
+CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
+
 ifeq ($(unwind-find-fde),yes)
 routines += unwind-dw2-fde-glibc
 shared-only-routines += unwind-dw2-fde-glibc