common.mak: Remove NO_PIE_LDFLAGS

Commit c5a91199e3 ("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
5e46632767 ("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 <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2025-10-15 12:34:58 +02:00
parent 0a711d4934
commit e6ac87d7a2
3 changed files with 2 additions and 3 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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