aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-06-30 12:03:41 +0100
committerMichael Brown <mcb30@ipxe.org>2023-06-30 12:20:38 +0100
commitf59b95d0e2e9911bb18a663ceca4279e644af35b (patch)
treeae64762641612c62c170a9f19325cd563a67d7ae
parente17568ad0642490143d0c6b154c874b9b9e285bf (diff)
downloadipxe-sepcode.zip
ipxe-sepcode.tar.gz
ipxe-sepcode.tar.bz2
[build] Use separate code segment if supported by linkersepcode
Some versions of ld will complain that the automatically created (and unused by our build process) ELF program headers include a "LOAD segment with RWX permissions". Silence this warning by adding "-z separate-code" to the linker options, where supported. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/Makefile.housekeeping7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index b32003e..061844e 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -502,6 +502,13 @@ LDFLAGS += --gc-sections
#
LDFLAGS += -static
+# Use separate code segment if supported by linker
+#
+ZSC_TEST = [ -z "`$(LD) -z separate-code --version 2>&1 > /dev/null`" ]
+ZSC_FLAGS := $(shell $(ZSC_TEST) && \
+ $(ECHO) '-z separate-code -z max-page-size=4096')
+LDFLAGS += $(ZSC_FLAGS)
+
# compiler.h is needed for our linking and debugging system
#
CFLAGS += -include include/compiler.h