Message ID | 9c6c64ba1cb113176e755348cf207cb3130fe82b.1706808745.git.crobinso@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide | expand |
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
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:
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(-)