Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
Date: Mon, 01 Feb 2021 18:02:00
Message-Id: 1612202510.082523538c69272bd967c8d7f521687886cb97bc.slyfox@gentoo
1 commit: 082523538c69272bd967c8d7f521687886cb97bc
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 1 18:01:27 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 1 18:01:50 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08252353
7
8 app-emulation/qemu: backport bios link no-pie fix on binutils-2.36
9
10 Package-Manager: Portage-3.0.14, Repoman-3.0.2
11 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
12
13 .../qemu/files/qemu-5.2.0-no-pie-ld.patch | 73 ++++++++++++++++++++++
14 app-emulation/qemu/qemu-5.2.0-r2.ebuild | 1 +
15 2 files changed, 74 insertions(+)
16
17 diff --git a/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch b/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch
18 new file mode 100644
19 index 00000000000..f47a58790cc
20 --- /dev/null
21 +++ b/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch
22 @@ -0,0 +1,73 @@
23 +From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
24 +From: Christian Ehrhardt <christian.ehrhardt@×××××××××.com>
25 +Date: Mon, 14 Dec 2020 16:09:38 +0100
26 +Subject: [PATCH] build: -no-pie is no functional linker flag
27 +
28 +Recent binutils changes dropping unsupported options [1] caused a build
29 +issue in regard to the optionroms.
30 +
31 + ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
32 + -s -o multiboot.img multiboot.o
33 + ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
34 +
35 +This isn't really a regression in ld.bfd, filing the bug upstream
36 +revealed that this never worked as a ld flag [2] - in fact it seems we
37 +were by accident setting --nmagic).
38 +
39 +Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
40 +droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
41 +in .mak, therefore we can also remove it from being added there.
42 +
43 +[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
44 +[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
45 +
46 +Signed-off-by: Christian Ehrhardt <christian.ehrhardt@×××××××××.com>
47 +Message-Id: <20201214150938.1297512-1-christian.ehrhardt@×××××××××.com>
48 +Cc: qemu-stable@××××××.org
49 +Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
50 +---
51 + configure | 3 ---
52 + pc-bios/optionrom/Makefile | 1 -
53 + 2 files changed, 4 deletions(-)
54 +
55 +--- a/configure
56 ++++ b/configure
57 +@@ -2137,7 +2137,6 @@ EOF
58 + # Check we support --no-pie first; we will need this for building ROMs.
59 + if compile_prog "-Werror -fno-pie" "-no-pie"; then
60 + CFLAGS_NOPIE="-fno-pie"
61 +- LDFLAGS_NOPIE="-no-pie"
62 + fi
63 +
64 + if test "$static" = "yes"; then
65 +@@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
66 + fi
67 + elif test "$pie" = "no"; then
68 + CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
69 +- CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
70 + elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
71 + CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
72 + CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
73 +@@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
74 + echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
75 + echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
76 + echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
77 +-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
78 + echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
79 + echo "EXESUF=$EXESUF" >> $config_host_mak
80 + echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
81 +diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
82 +index 084fc10f05..30771f8d17 100644
83 +--- a/pc-bios/optionrom/Makefile
84 ++++ b/pc-bios/optionrom/Makefile
85 +@@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
86 +
87 + LD_I386_EMULATION ?= elf_i386
88 + override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
89 +-override LDFLAGS += $(LDFLAGS_NOPIE)
90 +
91 + all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
92 +
93 +--
94 +2.30.0
95 +
96
97 diff --git a/app-emulation/qemu/qemu-5.2.0-r2.ebuild b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
98 index 90d6bcb7da4..f412ab52cd5 100644
99 --- a/app-emulation/qemu/qemu-5.2.0-r2.ebuild
100 +++ b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
101 @@ -229,6 +229,7 @@ PATCHES=(
102 "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
103 "${FILESDIR}"/${PN}-5.2.0-strings.patch
104 "${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
105 + "${FILESDIR}"/${PN}-5.2.0-no-pie-ld.patch
106 )
107
108 QA_PREBUILT="