From e6ac87d7a29136f5196584247e50879f30ddb32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 15 Oct 2025 12:34:58 +0200 Subject: [PATCH] common.mak: Remove NO_PIE_LDFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit c5a91199e399 ("zipl: Always build and link without PIE.") introduced -fno-pie (for compilation) and -no-pie (for linking) for zipl. At the time the linker was still used directly before commit 5e46632767cb ("zipl: Use the compiler for linking instead of ld") eventually switched to calling the compiler for the linking step. During that adaption -static was introduced to the linker flags. -no-pie was carried over as well. However -static implies -no-pie and it is therefore not required. For GCC see also man 1 gcc (-static) [1]. Whilst not explicitly documented, Clang shows the same behaviour. Clang also complains when -static and -no-pie are specified in the linker step at the same time with the following warning: clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument] Since -no-pie is not required, remove it and get rid of the warning. [1] https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-static Reviewed-by: Marc Hartmayer Signed-off-by: Jan Höppner --- common.mak | 1 - rust/pvimg/boot/Makefile | 2 +- zipl/boot/Makefile | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/common.mak b/common.mak index 527f75ba..359032d3 100644 --- a/common.mak +++ b/common.mak @@ -341,7 +341,6 @@ export INSTALL CFLAGS CXXFLAGS \ LDFLAGS CPPFLAGS ALL_CFLAGS ALL_CXXFLAGS ALL_LDFLAGS ALL_CPPFLAGS NO_PIE_CFLAGS := -fno-pie -NO_PIE_LDFLAGS := -no-pie # Overwrite implicit makefile rules for having nice compile output %.o: %.c diff --git a/rust/pvimg/boot/Makefile b/rust/pvimg/boot/Makefile index 1bff4f83..ad00371a 100644 --- a/rust/pvimg/boot/Makefile +++ b/rust/pvimg/boot/Makefile @@ -74,7 +74,7 @@ stage3b.elf: head.o $(ZIPL_OBJS) .SECONDARY: $(FILES:.bin=.lds) %.elf: %.lds %.o - $(LINK) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,-T,$< -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,-T,$< -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ %.bin.debug: %.elf diff --git a/zipl/boot/Makefile b/zipl/boot/Makefile index a7827a73..4ca0708a 100644 --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -93,7 +93,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o \ sclp_stage3.o kdump.o entry.o stage3.lds %.exec: %.o - $(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ + $(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ %.bin.debug: %.exec