From 4518bf7d73570823277e4e4e158ce2198c94aaca Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 18 Jan 2023 16:41:09 +0000 Subject: [PATCH] zipl/boot: use `--no-warn-rwx-segments` linker flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This disables the following warning `ld: warning: stage3.exec has a LOAD segment with RWX permissions` for newer linker. This changes nothing in functionality for the zipl bootloaders, since only the binaries and not the ELF files are actually used. Acked-by: Eduard Shishkin Reviewed-by: Stefan Haberland Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- common.mak | 14 ++++++++++++++ zipl/boot/Makefile | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/common.mak b/common.mak index 76408251..a863496f 100644 --- a/common.mak +++ b/common.mak @@ -145,6 +145,20 @@ then \ exit 1; \ 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 # diff --git a/zipl/boot/Makefile b/zipl/boot/Makefile index f195df0e..5ccbfb37 100644 --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -74,7 +74,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o \ 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 \