1 From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
2 From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
3 Date: Mon, 14 Dec 2020 16:09:38 +0100
4 Subject: [PATCH] build: -no-pie is no functional linker flag
6 Recent binutils changes dropping unsupported options [1] caused a build
7 issue in regard to the optionroms.
9 ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
10 -s -o multiboot.img multiboot.o
11 ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
13 This isn't really a regression in ld.bfd, filing the bug upstream
14 revealed that this never worked as a ld flag [2] - in fact it seems we
15 were by accident setting --nmagic).
17 Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
18 droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
19 in .mak, therefore we can also remove it from being added there.
21 [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
22 [2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
24 Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
25 Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
26 Cc: qemu-stable@nongnu.org
27 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
30 pc-bios/optionrom/Makefile | 1 -
31 2 files changed, 4 deletions(-)
33 diff --git a/configure b/configure
34 index cb21108d34c..c228f7c21e7 100755
37 @@ -2137,7 +2137,6 @@ EOF
38 # Check we support --no-pie first; we will need this for building ROMs.
39 if compile_prog "-Werror -fno-pie" "-no-pie"; then
40 CFLAGS_NOPIE="-fno-pie"
41 - LDFLAGS_NOPIE="-no-pie"
44 if test "$static" = "yes"; then
45 @@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
47 elif test "$pie" = "no"; then
48 CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
49 - CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
50 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
51 CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
52 CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
53 @@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
54 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
55 echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
56 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
57 -echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
58 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
59 echo "EXESUF=$EXESUF" >> $config_host_mak
60 echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
61 diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
62 index 084fc10f054..30771f8d17c 100644
63 --- a/pc-bios/optionrom/Makefile
64 +++ b/pc-bios/optionrom/Makefile
65 @@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
67 LD_I386_EMULATION ?= elf_i386
68 override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
69 -override LDFLAGS += $(LDFLAGS_NOPIE)
71 all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin