From 995635f95b707488c23bba07be8016c9682d4045 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 26 Dec 2016 10:08:48 +0100 Subject: Compile the dynamic linker without stack protection [BZ #7065] Also compile corresponding routines in the static libc.a with the same flag. --- elf/Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'elf/Makefile') diff --git a/elf/Makefile b/elf/Makefile index cd26e16..1e7d724 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 -- cgit v1.1