render / rpms / qemu

Forked from rpms/qemu 4 months ago
Clone

Blame 0001-pc-bios-optionrom-Fix-pvh.img-ld-build-failure-on-fe.patch

be1575
From 12cbd48e1e78f07b19df900b0f9ccdd633aa42ee Mon Sep 17 00:00:00 2001
Adam Williamson e5cb95
From: Cole Robinson <crobinso@redhat.com>
deeb93
Date: Mon, 27 Nov 2023 12:51:25 -0500
Adam Williamson e5cb95
Subject: [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora
Adam Williamson e5cb95
 rawhide
deeb93
Content-type: text/plain
Adam Williamson e5cb95
Adam Williamson e5cb95
binutils 2.39 shows some warnings when building pvh.img
Adam Williamson e5cb95
Adam Williamson e5cb95
/usr/bin/ld: warning: pvh.o: missing .note.GNU-stack section implies executable stack
Adam Williamson e5cb95
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
Adam Williamson e5cb95
/usr/bin/ld: warning: pvh.img has a LOAD segment with RWX permissions
Adam Williamson e5cb95
Adam Williamson e5cb95
The latter of which is fatal on Fedora rawhide for some reason.
Adam Williamson e5cb95
Adam Williamson e5cb95
Add linker options to suppress the errors
Adam Williamson e5cb95
Adam Williamson e5cb95
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Adam Williamson e5cb95
---
be1575
 pc-bios/optionrom/Makefile | 12 +++++++++++-
be1575
 1 file changed, 11 insertions(+), 1 deletion(-)
Adam Williamson e5cb95
Adam Williamson e5cb95
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
be1575
index 30d07026c7..87cfc484c7 100644
Adam Williamson e5cb95
--- a/pc-bios/optionrom/Makefile
Adam Williamson e5cb95
+++ b/pc-bios/optionrom/Makefile
be1575
@@ -38,6 +38,16 @@ config-cc.mak: Makefile
Adam Williamson e5cb95
 
be1575
 override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds
Adam Williamson e5cb95
 
be1575
+ld-test = $(LD) -v $1 >/dev/null 2>/dev/null
be1575
+ld-option = if $(call ld-test, $1); then \
be1575
+    echo "$(TARGET_PREFIX)$1 detected" && echo "override LDFLAGS += -Wl,$1" >&3; else \
be1575
+    echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "override LDFLAGS += $2" >&3;; fi
be1575
+
be1575
+config-ld.mak: Makefile
be1575
+	$(quiet-@)($(call ld-option,--no-warn-rwx-segments); \
be1575
+	    $(call ld-option,--no-warn-execstack)) 3> config-ld.mak
be1575
+-include config-ld.mak
be1575
+
Adam Williamson e5cb95
 pvh.img: pvh.o pvh_main.o
Adam Williamson e5cb95
 
be1575
 %.o: %.S
be1575
@@ -61,7 +71,7 @@ clean:
be1575
 	rm -f *.o *.d *.raw *.img *.bin *~
be1575
 
be1575
 distclean:
be1575
-	rm -f config-cc.mak
be1575
+	rm -f config-cc.mak config-ld.mak
be1575
 
be1575
 # suppress auto-removal of intermediate files
be1575
 .SECONDARY: