From: Marc Hartmayer <mhartmay@linux.ibm.com>
To: <qemu-devel@nongnu.org>, Thomas Huth <thuth@redhat.com>
Cc: qemu-s390x <qemu-s390x@nongnu.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Jens Remus <jremus@linux.ibm.com>
Subject: [PATCH v1 3/3] pc-bios/s390-ccw: Introduce `EXTRA_LDFLAGS`
Date: Tue, 1 Oct 2024 17:36:18 +0200 [thread overview]
Message-ID: <20241001153618.17791-4-mhartmay@linux.ibm.com> (raw)
In-Reply-To: <20241001153618.17791-1-mhartmay@linux.ibm.com>
Some packaging tools want to override `LDFLAGS` when building QEMU, this will
result in a build error as most likely no `-nostdlib` flag is passed. Introduce
`EXTRA_LDFLAGS` so that the packager can override `LDFLAGS` without breaking the
build.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
Note: Normally, I would rather use ALL_LDFLAGS, but adding EXTRA_LDFLAGS matches
with the current Makefile style.
---
pc-bios/s390-ccw/netboot.mak | 2 +-
pc-bios/s390-ccw/Makefile | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak
index 046aa35587ac..b1bc12603d99 100644
--- a/pc-bios/s390-ccw/netboot.mak
+++ b/pc-bios/s390-ccw/netboot.mak
@@ -6,7 +6,7 @@ NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o
LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include
LIBNET_INC := -I$(SLOF_DIR)/lib/libnet
-NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000
+NETLDFLAGS := $(EXTRA_LDFLAGS) $(LDFLAGS) -Wl,-Ttext=0x7800000
$(NETOBJS): EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC)
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index ab6bd1edf41e..56c971462992 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -4,6 +4,7 @@ all: build-all
include config-host.mak
CFLAGS = -O2 -g
+LDFLAGS ?=
MAKEFLAGS += -rR
GIT_SUBMODULES = roms/SLOF
@@ -40,7 +41,7 @@ EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE
EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables
EXTRA_CFLAGS += -msoft-float
EXTRA_CFLAGS += -std=gnu99
-LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text
+EXTRA_LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text
cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
cc-option = if $(call cc-test, $1); then \
@@ -58,7 +59,7 @@ config-cc.mak: Makefile
build-all: s390-ccw.img s390-netboot.img
s390-ccw.elf: $(OBJECTS)
- $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking)
+ $(call quiet-command,$(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $(OBJECTS),Linking)
s390-ccw.img: s390-ccw.elf
$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
--
2.43.0
next prev parent reply other threads:[~2024-10-01 15:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 15:36 [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 1/3] pc-bios/s390-ccw: Clarify alignment is in bytes Marc Hartmayer
2024-10-01 15:36 ` [PATCH v1 2/3] pc-bios/s390-ccw: Don't generate TEXTRELs Marc Hartmayer
2024-10-01 15:36 ` Marc Hartmayer [this message]
2024-10-02 9:57 ` [PATCH v1 0/3] pc-bios/s390-ccw: Small Makefile improvements Thomas Huth
2024-10-02 10:13 ` Marc Hartmayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241001153618.17791-4-mhartmay@linux.ibm.com \
--to=mhartmay@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=jremus@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).