This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 06/14] Compile the entire dynamic linker with -fno-stack-protector.
- From: Nix <nix at esperi dot org dot uk>
- To: libc-alpha at sourceware dot org
- Date: Wed, 24 Feb 2016 23:28:12 +0000
- Subject: [PATCH 06/14] Compile the entire dynamic linker with -fno-stack-protector.
- Authentication-results: sourceware.org; auth=none
- References: <1456356500-25601-1-git-send-email-nix at esperi dot org dot uk>
From: Nick Alcock <nick.alcock@oracle.com>
Also compile corresponding routines in the static libc.a with the same
flag.
v3: Use $(no-stack-protector).
Introduce $(elide-stack-protector) and use it to reduce redundancy.
Bring all the elisions together textually.
---
elf/Makefile | 13 +++++++++++++
elf/rtld-Rules | 2 ++
2 files changed, 15 insertions(+)
diff --git a/elf/Makefile b/elf/Makefile
index 63a5355..0037cca 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -50,6 +50,19 @@ 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 ld.so 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-.og += $(call elide-stack-protector,.og,$(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
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index c1bb506..aff4e3e 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -144,4 +144,6 @@ cpp-srcs-left := $(rtld-modules:%.os=%)
lib := rtld
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+rtld-CFLAGS := $(no-stack-protector)
+
endif
--
2.7.0.198.g6dd47b6