summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2023-10-04 23:09:25 -0500
committerZach van Rijn <me@zv.io>2023-10-04 23:09:25 -0500
commita192def39ee9a44cb8c05f8367240a7acf17539a (patch)
tree445457ca6c20443b646777b3987e4b75d4d5a629
parentc9cefa5a0e06a8039878e92726a245421fb2ce61 (diff)
downloadpackages-a192def39ee9a44cb8c05f8367240a7acf17539a.tar.gz
packages-a192def39ee9a44cb8c05f8367240a7acf17539a.tar.bz2
packages-a192def39ee9a44cb8c05f8367240a7acf17539a.tar.xz
packages-a192def39ee9a44cb8c05f8367240a7acf17539a.zip
user/qemu: patch unsupported ld flag. fixes #1075.
-rw-r--r--user/qemu/APKBUILD4
-rw-r--r--user/qemu/fix-no-pie-ld-flag.patch71
2 files changed, 74 insertions, 1 deletions
diff --git a/user/qemu/APKBUILD b/user/qemu/APKBUILD
index 4254f3a62..c707b5c8e 100644
--- a/user/qemu/APKBUILD
+++ b/user/qemu/APKBUILD
@@ -6,7 +6,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=qemu
pkgver=4.2.0
-pkgrel=1
+pkgrel=2
pkgdesc="Machine emulator and virtualisation software"
url="https://www.qemu.org/"
arch="all"
@@ -157,6 +157,7 @@ source="https://download.qemu.org/$pkgname-$pkgver.tar.xz
signal-fixes.patch
sysinfo-header.patch
fix-lm32-underlinking.patch
+ fix-no-pie-ld-flag.patch
time64.patch
MAP_SYNC-fix.patch
CVE-2020-1711.patch
@@ -454,6 +455,7 @@ fb0130fa4e8771b23ae337ea3e5e29fd5f7dcfe7f9f7a68968f5b059bb4dd1336b0d04c118840d55
c6436b1cc986788baccd5fe0f9d23c7db9026f6b723260611cf894bd94ee830140a17ee5859efe0dad0ca3bfe9caae1269bc5c9ab4c6e696f35c7857c1b5c86b signal-fixes.patch
698f6b134f4ca87f4de62caf7a656841a40a451b8686ca95928f67a296e58a7493d432d9baa5f6360917865aa4929600baf1699993b0600923a066ca9d45d1da sysinfo-header.patch
2828cc612539aa93b5789de7de6d4f85d3cf82311484c0fe91fdd3efeb972057e2baa2a3809ed633d6caa1785642d49196cb282b095d7553c510c47ce7d6a702 fix-lm32-underlinking.patch
+61a0bc1c3cc902f3ead47c4f3a7651768e8f01d655494c53600f28cecf27cdb3d2f3e3778750154bb54e92006005b6ca629e30683c47d18dd4a20feafa64c8cd fix-no-pie-ld-flag.patch
44db77cab330075da601cc6083678c5f3ed1528936a8fd81148875bc67ed53332b21466c79ac6e5cf2b2e7d3824392dd7a52d0aaed03689be9b2dfddd5abba06 time64.patch
d7de79ea74e36702cac4a59e472564a55f0a663be7e63c3755e32b4b5dfbc04b390ee79f09f43f6ae706ee2aec9e005eade3c0fd4a202db60d11f436874a17d7 MAP_SYNC-fix.patch
0ea3745c45507c00c3c036241992d594b5f7e9aa1f0fa9b425dd222390066e1ea2d0aa4923bde0e7f27b7cc2f759a122ae4b600c2fa682a5aad509e7d03ccad9 CVE-2020-1711.patch
diff --git a/user/qemu/fix-no-pie-ld-flag.patch b/user/qemu/fix-no-pie-ld-flag.patch
new file mode 100644
index 000000000..5501a267f
--- /dev/null
+++ b/user/qemu/fix-no-pie-ld-flag.patch
@@ -0,0 +1,71 @@
+This patch differs from upstream in the following way:
+
+ * It applies to 4.2.0
+
+From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
+From: Christian Ehrhardt <christian.ehrhardt@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@canonical.com>
+Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+---
+ configure | 3 ---
+ pc-bios/optionrom/Makefile | 1 -
+ 2 files changed, 4 deletions(-)
+
+diff -ur a/configure b/configure
+--- a/configure 2023-10-05 04:04:33.203940722 +0000
++++ b/configure 2023-10-05 04:04:58.968996416 +0000
+@@ -2045,7 +2045,6 @@
+ # check we support --no-pie first...
+ if compile_prog "-Werror -fno-pie" "-no-pie"; then
+ CFLAGS_NOPIE="-fno-pie"
+- LDFLAGS_NOPIE="-nopie"
+ fi
+
+ if compile_prog "-fPIE -DPIE" "-pie"; then
+@@ -7515,7 +7514,6 @@
+ echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
+ fi
+ echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
+-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
+ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
+ echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
+ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
+diff -ur a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
+--- a/pc-bios/optionrom/Makefile 2023-10-05 04:04:34.143979321 +0000
++++ b/pc-bios/optionrom/Makefile 2023-10-05 04:06:01.267530732 +0000
+@@ -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)$@")