qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] meson: remove -no-pie linker flag


From: Richard Henderson
Subject: Re: [PATCH] meson: remove -no-pie linker flag
Date: Mon, 22 May 2023 07:39:14 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 5/22/23 01:08, Paolo Bonzini wrote:
The large comment in the patch says it all; the -no-pie flag is broken and
this is why it was not included in QEMU_LDFLAGS before commit a988b4c5614
("build: move remaining compiler flag tests to meson", 2023-05-18).

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1664
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
  meson.build | 13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 0a5cdefd4d3d..6733b2917081 100644
--- a/meson.build
+++ b/meson.build
@@ -267,10 +267,15 @@ endif
  # has explicitly disabled PIE we need to extend our cflags.
  if not get_option('b_pie')
    qemu_common_flags += cc.get_supported_arguments('-fno-pie')
-  if not get_option('prefer_static')
-    # No PIE is implied by -static which we added above.
-    qemu_ldflags += cc.get_supported_link_arguments('-no-pie')
-  endif
+  # What about linker flags?  For a static build, no PIE is implied by -static
+  # which we added above.

Is it though?  That was the major problem at the time: it wasn't.

IIRC, debian has enabled link-pie-by-default, so '-static' meant '-static-pie'. Moreover, not all of their static libraries were built -fpie, which led to link errors.

Trying both now, e.g. '--static --disable-system --disable-tools 
--disable-docs',
a link line contains

... -Wl,--as-needed -Wl,--no-undefined -pie -Wl,--whole-archive libhwcore.fa ...
                                       ^^^^

Where does that come from, and why isn't -no-pie the antidote?


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]