s390-tools/s390-tools-sles15sp5-03-zipl-boot-use-no-warn-rwx-segments-linker-flag.patch

40 lines
1.1 KiB
Diff
Raw Normal View History

---
common.mak | 14 ++++++++++++++
zipl/boot/Makefile | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
--- a/common.mak
+++ b/common.mak
@@ -146,6 +146,20 @@ then \
fi
#
+# Test for linker option
+#
+# $1: Linker option
+#
+# Returns the linker option if available and nothing otherwise
+#
+define test_linker_flag
+$(shell printf "int main(void) {return 0;}\n" | \
+ ( $(CC) "-Wl,$1" -o /dev/null -x c - ) >/dev/null 2>&1 && printf -- '-Wl,%s' "$1")
+endef
+
+NO_WARN_RWX_SEGMENTS_LDFLAGS := $(call test_linker_flag,"--no-warn-rwx-segments")
+
+#
# Support alternate install root
#
# INSTALLDIR: Finally install s390-tools to INSTALLDIR. This can be used
--- a/zipl/boot/Makefile
+++ b/zipl/boot/Makefile
@@ -75,7 +75,7 @@ stage3.exec: head.o stage3.o kdump3.o li
2) SFLAGS="-Wl,-T,stage2.lds";; \
3) SFLAGS="-Wl,-T,stage3.lds";; \
esac; \
- $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@
+ $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -m64 -static -nostdlib $(filter %.o, $^) -o $@
%.bin: %.exec
$(OBJCOPY) -O binary \