configure, meson: move linker flag detection to meson
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b485458e00
commit
e4333d14c5
16
configure
vendored
16
configure
vendored
@ -1342,12 +1342,10 @@ EOF
|
|||||||
if test "$static" = "yes"; then
|
if test "$static" = "yes"; then
|
||||||
if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
|
if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
|
||||||
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
|
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
|
||||||
QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
|
|
||||||
pie="yes"
|
pie="yes"
|
||||||
elif test "$pie" = "yes"; then
|
elif test "$pie" = "yes"; then
|
||||||
error_exit "-static-pie not available due to missing toolchain support"
|
error_exit "-static-pie not available due to missing toolchain support"
|
||||||
else
|
else
|
||||||
QEMU_LDFLAGS="-static $QEMU_LDFLAGS"
|
|
||||||
pie="no"
|
pie="no"
|
||||||
fi
|
fi
|
||||||
elif test "$pie" = "no"; then
|
elif test "$pie" = "no"; then
|
||||||
@ -1369,12 +1367,6 @@ else
|
|||||||
pie="no"
|
pie="no"
|
||||||
fi
|
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
|
# __sync_fetch_and_and requires at least -march=i486. Many toolchains
|
||||||
# use i686 as default anyway, but for those that don't, an explicit
|
# use i686 as default anyway, but for those that don't, an explicit
|
||||||
@ -2242,14 +2234,6 @@ if test "$have_ubsan" = "yes"; then
|
|||||||
fi
|
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
|
# Guest agent Windows MSI package
|
||||||
|
|
||||||
if test "$QEMU_GA_MANUFACTURER" = ""; then
|
if test "$QEMU_GA_MANUFACTURER" = ""; then
|
||||||
|
13
meson.build
13
meson.build
@ -183,6 +183,14 @@ qemu_cflags = config_host['QEMU_CFLAGS'].split()
|
|||||||
qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
|
qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
|
||||||
qemu_ldflags = config_host['QEMU_LDFLAGS'].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'
|
if targetos == 'windows'
|
||||||
qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat')
|
qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat')
|
||||||
# Disable ASLR for debug builds to allow debugging with gdb
|
# Disable ASLR for debug builds to allow debugging with gdb
|
||||||
@ -265,6 +273,11 @@ if add_languages('cpp', required: false, native: false)
|
|||||||
endif
|
endif
|
||||||
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'])
|
add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc'])
|
||||||
|
|
||||||
if targetos == 'linux'
|
if targetos == 'linux'
|
||||||
|
Loading…
Reference in New Issue
Block a user