From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 3/4] qemu: Patch required to build with updated binutils-2.36.1 Date: Wed, 21 Apr 2021 23:26:25 +0200 Message-ID: <20210421212626.2729436-3-adolf.belka@ipfire.org> In-Reply-To: <20210421212626.2729436-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2271027669295173480==" List-Id: --===============2271027669295173480== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - Updated binutils caused failure in build of qemu Patch solved the problem This removes the -no-pie flag - Thanks to Michael Tremer and Marcel Lorenz for guidance on the patch Signed-off-by: Adolf Belka --- lfs/qemu | 4 +- src/patches/qemu-5.2.0-no-pie.patch | 67 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/patches/qemu-5.2.0-no-pie.patch diff --git a/lfs/qemu b/lfs/qemu index aa09fa0ca..77bd00287 100644 --- a/lfs/qemu +++ b/lfs/qemu @@ -33,7 +33,7 @@ DIR_APP =3D $(DIR_SRC)/$(THISAPP) TARGET =3D $(DIR_INFO)/$(THISAPP) SUP_ARCH =3D i586 x86_64 PROG =3D qemu -PAK_VER =3D 30 +PAK_VER =3D 31 =20 DEPS =3D libusbredir spice libseccomp =20 @@ -88,6 +88,8 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/qemu-5.2.0-no-pie.patch cd $(DIR_APP) && ./configure \ --prefix=3D/usr \ --sysconfdir=3D/etc \ diff --git a/src/patches/qemu-5.2.0-no-pie.patch b/src/patches/qemu-5.2.0-no-= pie.patch new file mode 100644 index 000000000..8f3f4d590 --- /dev/null +++ b/src/patches/qemu-5.2.0-no-pie.patch @@ -0,0 +1,67 @@ +Recent binutils changes dropping unsupported options [1] caused a build +issue in regard to the optionroms. + + ld -m elf_i386 -T /<>/pc-bios/optionrom//flat.lds -no-pie \ + -s -o multiboot.img multiboot.o + ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?) + +This isn't really a regression in ld.bfd, filing the bug upstream +revealed that this never worked as a ld flag [2] - in fact it seems we +were by accident setting --nmagic). + +Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be +droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE +in .mak, therefore we can also remove it from being added there. + +[1]: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D983d925d +[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=3D27050#c5 + +Signed-off-by: Christian Ehrhardt +--- + configure | 3 --- + pc-bios/optionrom/Makefile | 1 - + 2 files changed, 4 deletions(-) + +diff --git a/configure b/configure +index 3f823ed163..61c17c2dde 100755 +--- a/configure ++++ b/configure +@@ -2133,7 +2133,6 @@ EOF + # Check we support --no-pie first; we will need this for building ROMs. + if compile_prog "-Werror -fno-pie" "-no-pie"; then + CFLAGS_NOPIE=3D"-fno-pie" +- LDFLAGS_NOPIE=3D"-no-pie" + fi +=20 + if test "$static" =3D "yes"; then +@@ -2149,7 +2148,6 @@ if test "$static" =3D "yes"; then + fi + elif test "$pie" =3D "no"; then + CONFIGURE_CFLAGS=3D"$CFLAGS_NOPIE $CONFIGURE_CFLAGS" +- CONFIGURE_LDFLAGS=3D"$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS" + elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then + CONFIGURE_CFLAGS=3D"-fPIE -DPIE $CONFIGURE_CFLAGS" + CONFIGURE_LDFLAGS=3D"-pie $CONFIGURE_LDFLAGS" +@@ -6768,7 +6766,6 @@ echo "QEMU_CXXFLAGS=3D$QEMU_CXXFLAGS" >> $config_host_= mak + echo "GLIB_CFLAGS=3D$glib_cflags" >> $config_host_mak + echo "GLIB_LIBS=3D$glib_libs" >> $config_host_mak + echo "QEMU_LDFLAGS=3D$QEMU_LDFLAGS" >> $config_host_mak +-echo "LDFLAGS_NOPIE=3D$LDFLAGS_NOPIE" >> $config_host_mak + echo "LD_I386_EMULATION=3D$ld_i386_emulation" >> $config_host_mak + echo "EXESUF=3D$EXESUF" >> $config_host_mak + echo "HOST_DSOSUF=3D$HOST_DSOSUF" >> $config_host_mak +diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile +index 084fc10f05..30771f8d17 100644 +--- a/pc-bios/optionrom/Makefile ++++ b/pc-bios/optionrom/Makefile +@@ -41,7 +41,6 @@ override CFLAGS +=3D $(call cc-option, $(Wa)-32) +=20 + LD_I386_EMULATION ?=3D elf_i386 + override LDFLAGS =3D -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds +-override LDFLAGS +=3D $(LDFLAGS_NOPIE) +=20 + all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin +=20 +--=20 +2.29.2 + --=20 2.31.1 --===============2271027669295173480==--