diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2020-04-29 22:28:10 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-07-25 17:33:29 +0100 |
commit | c562319cdba0102c3a8a8298ba94e645418193d5 (patch) | |
tree | e73343d2787827ff969a99f8478663d610a3c40e | |
parent | 312b3d0a38ff2e43becd47cf1f4a930bc0c4b8e6 (diff) | |
download | klibc-c562319cdba0102c3a8a8298ba94e645418193d5.tar.gz |
[klibc] Kbuild: Add a per-architecture option to disable exectable stacks
We still want to avoid executable stacks, but now we will only do so
for architectures where we know we can avoid stack trampolines for
signal return.
Disable executable stacks only if KLIBCEXECSTACK is set to 'n' by the
architecture's MCONFIG.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | scripts/Kbuild.klibc | 5 | ||||
-rw-r--r-- | usr/klibc/Kbuild | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index b7e99b567f6c52..a9a2a40ec7a57f 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -118,13 +118,16 @@ KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ $(if $(KBUILD_SRC),-I$(srctree)/include) \ $(KLIBCARCHINCFLAGS) +# compiler/assembler option for whether we want an executable stack +KLIBCSTACKFLAGS := -Wa,$(if $(filter n,$(KLIBCEXECSTACK)),no)execstack + # klibc definitions KLIBCDEFS += -D__KLIBC__=$(KLIBCMAJOR) \ -D__KLIBC_MINOR__=$(KLIBCMINOR) \ -D_BITSIZE=$(KLIBCBITSIZE) KLIBCCPPFLAGS += $(KLIBCDEFS) KLIBCCFLAGS += $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS) \ - $(KLIBCOPTFLAGS) $(KLIBCWARNFLAGS) + $(KLIBCOPTFLAGS) $(KLIBCSTACKFLGS) $(KLIBCWARNFLAGS) KLIBCAFLAGS += -D__ASSEMBLY__ $(KLIBCCFLAGS) KLIBCSTRIPFLAGS += --strip-all -R .comment -R .note diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index bec9cdb448ccde..c6338851712570 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -185,6 +185,7 @@ quiet_cmd_interp = BUILD $@ cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \ -DLIBDIR=\"$(SHLIBDIR)\" \ -DSOHASH=\"$(SOLIBHASH)\" \ + $(KLIBCSTACKFLAGS) \ -c -o $@ $< $(INTERP_O): $(obj)/interp.S $(SOLIB).hash |