[packages/qemu] adapted upstream patch to fix build with binutils 2.36

atler atler at pld-linux.org
Tue Mar 9 12:39:52 CET 2021


commit 7d5d8d6e7edcaea94e5ed4426999afced9f4877c
Author: Jan Palus <atler at pld-linux.org>
Date:   Tue Mar 9 12:39:13 2021 +0100

    adapted upstream patch to fix build with binutils 2.36

 binutils-2.36.patch | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 qemu.spec           |  2 ++
 2 files changed, 77 insertions(+)
---
diff --git a/qemu.spec b/qemu.spec
index 12d6747..1225637 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -73,6 +73,7 @@ Patch3:		%{name}-xattr.patch
 Patch4:		libjpeg-boolean.patch
 Patch5:		x32.patch
 Patch6:		%{name}-vxhs.patch
+Patch7:		binutils-2.36.patch
 URL:		https://www.qemu.org/
 %{?with_opengl:BuildRequires:	Mesa-libgbm-devel}
 %{?with_opengl:BuildRequires:	OpenGL-GLX-devel}
@@ -959,6 +960,7 @@ Sondy systemtap/dtrace dla QEMU.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 
 %{__sed} -i '1s,/usr/bin/env python3,%{__python3},' scripts/qemu-trace-stap
 
diff --git a/binutils-2.36.patch b/binutils-2.36.patch
new file mode 100644
index 0000000..0bd9eed
--- /dev/null
+++ b/binutils-2.36.patch
@@ -0,0 +1,75 @@
+From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
+From: Christian Ehrhardt <christian.ehrhardt at canonical.com>
+Date: Mon, 14 Dec 2020 16:09:38 +0100
+Subject: [PATCH] build: -no-pie is no functional linker flag
+
+Recent binutils changes dropping unsupported options [1] caused a build
+issue in regard to the optionroms.
+
+  ld -m elf_i386 -T /<<PKGBUILDDIR>>/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=binutils-gdb.git;a=commit;h=983d925d
+[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
+
+Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
+Message-Id: <20201214150938.1297512-1-christian.ehrhardt at canonical.com>
+Cc: qemu-stable at nongnu.org
+Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
+---
+ configure                  | 3 ---
+ pc-bios/optionrom/Makefile | 1 -
+ 2 files changed, 4 deletions(-)
+
+diff --git a/configure b/configure
+index cb21108d34c..c228f7c21e7 100755
+--- a/configure
++++ b/configure
+@@ -2137,7 +2137,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="-fno-pie"
+-  LDFLAGS_NOPIE="-no-pie"
+ fi
+ 
+ if test "$static" = "yes"; then
+@@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
+   fi
+ elif test "$pie" = "no"; then
+   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
+-  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
+ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
+   QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
+   QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
+@@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
+   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
+ fi
+ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
+-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
+ echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
+ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
+ echo "LIBS+=$LIBS" >> $config_host_mak
+--- qemu-5.0.0/pc-bios/optionrom/Makefile.orig	2020-04-28 18:49:25.000000000 +0200
++++ qemu-5.0.0/pc-bios/optionrom/Makefile	2021-03-09 12:33:41.049922063 +0100
+@@ -47,10 +47,10 @@
+ 	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
+ 
+ pvh.img: pvh.o pvh_main.o
+-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
++	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+ 
+ %.img: %.o
+-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
++	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+ 
+ %.raw: %.img
+ 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/qemu.git/commitdiff/7d5d8d6e7edcaea94e5ed4426999afced9f4877c



More information about the pld-cvs-commit mailing list