qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PULL 12/14] configure, meson: move linker flag detection to meson
Date: Thu, 29 Sep 2022 18:30:12 +0200	[thread overview]
Message-ID: <20220929163014.16950-13-pbonzini@redhat.com> (raw)
In-Reply-To: <20220929163014.16950-1-pbonzini@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 16 ----------------
 meson.build | 13 +++++++++++++
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index 3e3c0f36c9..e032bd0a08 100755
--- a/configure
+++ b/configure
@@ -1342,12 +1342,10 @@ EOF
 if test "$static" = "yes"; then
   if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
     CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
-    QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
     pie="yes"
   elif test "$pie" = "yes"; then
     error_exit "-static-pie not available due to missing toolchain support"
   else
-    QEMU_LDFLAGS="-static $QEMU_LDFLAGS"
     pie="no"
   fi
 elif test "$pie" = "no"; then
@@ -1369,12 +1367,6 @@ else
   pie="no"
 fi
 
-# Detect support for PT_GNU_RELRO + DT_BIND_NOW.
-# The combination is known as "full relro", because .got.plt is read-only too.
-if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
-  QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
-fi
-
 ##########################################
 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
 # use i686 as default anyway, but for those that don't, an explicit
@@ -2242,14 +2234,6 @@ if test "$have_ubsan" = "yes"; then
 fi
 
 ##########################################
-
-# Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
-if test "$solaris" = "no" && test "$tsan" = "no"; then
-    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
-        QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS"
-    fi
-fi
-
 # Guest agent Windows MSI package
 
 if test "$QEMU_GA_MANUFACTURER" = ""; then
diff --git a/meson.build b/meson.build
index a1b265b133..f6962834a3 100644
--- a/meson.build
+++ b/meson.build
@@ -183,6 +183,14 @@ qemu_cflags = config_host['QEMU_CFLAGS'].split()
 qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
 qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
 
+if enable_static
+  qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
+endif
+
+# Detect support for PT_GNU_RELRO + DT_BIND_NOW.
+# The combination is known as "full relro", because .got.plt is read-only too.
+qemu_ldflags += cc.get_supported_link_arguments('-Wl,-z,relro', '-Wl,-z,now')
+
 if targetos == 'windows'
   qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat')
   # Disable ASLR for debug builds to allow debugging with gdb
@@ -265,6 +273,11 @@ if add_languages('cpp', required: false, native: false)
   endif
 endif
 
+# Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
+if targetos != 'sunos' and not config_host.has_key('CONFIG_TSAN')
+  qemu_ldflags += linker.get_supported_link_arguments('-Wl,--warn-common')
+endif
+
 add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc'])
 
 if targetos == 'linux'
-- 
2.37.3



  parent reply	other threads:[~2022-09-29 17:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 16:30 [PULL 00/14] x86 + misc changes for 2022-09-29 Paolo Bonzini
2022-09-29 16:30 ` [PULL 01/14] x86: return modified setup_data only if read as memory, not as file Paolo Bonzini
2022-09-29 16:30 ` [PULL 02/14] x86: use typedef for SetupData struct Paolo Bonzini
2022-09-29 16:30 ` [PULL 03/14] x86: reinitialize RNG seed on system reboot Paolo Bonzini
2022-09-29 16:30 ` [PULL 04/14] x86: re-enable rng seeding via SetupData Paolo Bonzini
2022-09-29 16:30 ` [PULL 05/14] qboot: rebuild based on latest commit Paolo Bonzini
2022-09-29 16:30 ` [PULL 06/14] configure: do not invoke as/ld directly for pc-bios/optionrom Paolo Bonzini
2022-09-29 16:30 ` [PULL 07/14] watchdog: remove -watchdog option Paolo Bonzini
2022-09-29 16:30 ` [PULL 08/14] ui: fix path to dbus-display1.h Paolo Bonzini
2022-09-29 16:30 ` [PULL 09/14] meson: require 0.61.3 Paolo Bonzini
2022-09-29 16:30 ` [PULL 10/14] meson: multiple names can be passed to dependency() Paolo Bonzini
2022-09-29 16:30 ` [PULL 11/14] configure, meson: move C++ compiler detection to meson.build Paolo Bonzini
2022-09-29 16:30 ` Paolo Bonzini [this message]
2022-09-29 16:30 ` [PULL 13/14] target/i386/kvm: fix kvmclock_current_nsec: Assertion `time.tsc_timestamp <= migration_tsc' failed Paolo Bonzini
2022-09-29 16:30 ` [PULL 14/14] x86: re-initialize RNG seed when selecting kernel Paolo Bonzini
2022-09-29 21:02 ` [PULL 00/14] x86 + misc changes for 2022-09-29 Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929163014.16950-13-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).