* [PATCH] build: -no-pie is no functional linker flag
@ 2020-12-14 15:09 Christian Ehrhardt
2020-12-14 16:28 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ehrhardt @ 2020-12-14 15:09 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Christian Ehrhardt
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>
---
configure | 3 ---
pc-bios/optionrom/Makefile | 1 -
2 files changed, 4 deletions(-)
diff --git a/configure b/configure
index 3f823ed163..61c17c2dde 100755
--- a/configure
+++ b/configure
@@ -2133,7 +2133,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
@@ -2149,7 +2148,6 @@ if test "$static" = "yes"; then
fi
elif test "$pie" = "no"; then
CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
- CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
@@ -6768,7 +6766,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 084fc10f05..30771f8d17 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
LD_I386_EMULATION ?= elf_i386
override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
-override LDFLAGS += $(LDFLAGS_NOPIE)
all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] build: -no-pie is no functional linker flag
2020-12-14 15:09 [PATCH] build: -no-pie is no functional linker flag Christian Ehrhardt
@ 2020-12-14 16:28 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-12-14 16:28 UTC (permalink / raw)
To: Christian Ehrhardt, qemu-devel
On 14/12/20 16:09, Christian Ehrhardt wrote:
> 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>
-no-pie (not -fno-pie!) _can_ be passed to gcc when it is used to drive
the linker. But indeed since the only use is in an "ld" invocation, the
patch is okay. Thanks!
Paolo
> ---
> configure | 3 ---
> pc-bios/optionrom/Makefile | 1 -
> 2 files changed, 4 deletions(-)
>
> diff --git a/configure b/configure
> index 3f823ed163..61c17c2dde 100755
> --- a/configure
> +++ b/configure
> @@ -2133,7 +2133,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
> @@ -2149,7 +2148,6 @@ if test "$static" = "yes"; then
> fi
> elif test "$pie" = "no"; then
> CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
> - CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
> elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
> CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
> CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
> @@ -6768,7 +6766,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
> echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
> echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
> echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
> -echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
> echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
> echo "EXESUF=$EXESUF" >> $config_host_mak
> echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
> diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> index 084fc10f05..30771f8d17 100644
> --- a/pc-bios/optionrom/Makefile
> +++ b/pc-bios/optionrom/Makefile
> @@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
>
> LD_I386_EMULATION ?= elf_i386
> override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
> -override LDFLAGS += $(LDFLAGS_NOPIE)
>
> all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-14 16:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14 15:09 [PATCH] build: -no-pie is no functional linker flag Christian Ehrhardt
2020-12-14 16:28 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).