* [PATCH v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
@ 2024-02-01 19:36 Cole Robinson
2024-04-06 18:34 ` Cole Robinson
0 siblings, 1 reply; 2+ messages in thread
From: Cole Robinson @ 2024-02-01 19:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Gerd Hoffmann, Cole Robinson
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
2024-02-01 19:36 [PATCH v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide Cole Robinson
@ 2024-04-06 18:34 ` Cole Robinson
0 siblings, 0 replies; 2+ messages in thread
From: Cole Robinson @ 2024-04-06 18:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Gerd Hoffmann
It doesn't appear this patch is neccessary to build on fedora rawhide
anymore, qemu 9.0.0-rc2 is building fine there
Thanks,
Cole
On 2/1/24 2:36 PM, Cole Robinson wrote:
> 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:
- Cole
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-06 18:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01 19:36 [PATCH v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide Cole Robinson
2024-04-06 18:34 ` Cole Robinson
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).