]> git.pld-linux.org Git - packages/qemu.git/blob - binutils-2.36.patch
adapted upstream patch to fix build with binutils 2.36
[packages/qemu.git] / binutils-2.36.patch
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
5
6 Recent binutils changes dropping unsupported options [1] caused a build
7 issue in regard to the optionroms.
8
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 ?)
12
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).
16
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.
20
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
23
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>
28 ---
29  configure                  | 3 ---
30  pc-bios/optionrom/Makefile | 1 -
31  2 files changed, 4 deletions(-)
32
33 diff --git a/configure b/configure
34 index cb21108d34c..c228f7c21e7 100755
35 --- a/configure
36 +++ b/configure
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"
42  fi
43  
44  if test "$static" = "yes"; then
45 @@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
46    fi
47  elif test "$pie" = "no"; then
48    QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
49 -  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
50  elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
51    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
52    QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
53 @@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
54    echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
55  fi
56  echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
57 -echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
58  echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
59  echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
60  echo "LIBS+=$LIBS" >> $config_host_mak
61 --- qemu-5.0.0/pc-bios/optionrom/Makefile.orig  2020-04-28 18:49:25.000000000 +0200
62 +++ qemu-5.0.0/pc-bios/optionrom/Makefile       2021-03-09 12:33:41.049922063 +0100
63 @@ -47,10 +47,10 @@
64         $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
65  
66  pvh.img: pvh.o pvh_main.o
67 -       $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
68 +       $(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
69  
70  %.img: %.o
71 -       $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
72 +       $(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
73  
74  %.raw: %.img
75         $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
This page took 0.056899 seconds and 3 git commands to generate.