From: Cole Robinson <crobinso@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Cole Robinson <crobinso@redhat.com>
Subject: [PATCH v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
Date: Thu, 1 Feb 2024 14:36:21 -0500 [thread overview]
Message-ID: <9c6c64ba1cb113176e755348cf207cb3130fe82b.1706808745.git.crobinso@redhat.com> (raw)
binutils 2.39 shows some warnings when building pvh.img
/usr/bin/ld: warning: pvh.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: warning: pvh.img has a LOAD segment with RWX permissions
The latter of which is fatal on Fedora rawhide for some reason.
This adds linker options to suppress the errors, if ld supports
the new options.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
v2:
- Check if ld supports the options, they are fairly new.
Uses the same `ld -v $CHECKOPT` pattern as kernel.git uses
Stuffs the overrides in `config-ld.mak` similar to `config-cc.mak`
pattern
pc-bios/optionrom/Makefile | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 30d07026c7..87cfc484c7 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -38,6 +38,16 @@ config-cc.mak: Makefile
override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds
+ld-test = $(LD) -v $1 >/dev/null 2>/dev/null
+ld-option = if $(call ld-test, $1); then \
+ echo "$(TARGET_PREFIX)$1 detected" && echo "override LDFLAGS += -Wl,$1" >&3; else \
+ echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "override LDFLAGS += $2" >&3); fi
+
+config-ld.mak: Makefile
+ $(quiet-@)($(call ld-option,--no-warn-rwx-segments); \
+ $(call ld-option,--no-warn-execstack)) 3> config-ld.mak
+-include config-ld.mak
+
pvh.img: pvh.o pvh_main.o
%.o: %.S
@@ -61,7 +71,7 @@ clean:
rm -f *.o *.d *.raw *.img *.bin *~
distclean:
- rm -f config-cc.mak
+ rm -f config-cc.mak config-ld.mak
# suppress auto-removal of intermediate files
.SECONDARY:
--
2.43.0
next reply other threads:[~2024-02-01 19:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 19:36 Cole Robinson [this message]
2024-04-06 18:34 ` [PATCH v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide Cole Robinson
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=9c6c64ba1cb113176e755348cf207cb3130fe82b.1706808745.git.crobinso@redhat.com \
--to=crobinso@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).