@@ -1023,7 +1023,6 @@ for opt do
;;
--static)
static="yes"
- LDFLAGS="-static $LDFLAGS"
QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
;;
--mandir=*) mandir="$optarg"
@@ -1994,11 +1993,6 @@ if test "$static" = "yes" ; then
if test "$modules" = "yes" ; then
error_exit "static and modules are mutually incompatible"
fi
- if test "$pie" = "yes" ; then
- error_exit "static and pie are mutually incompatible"
- else
- pie="no"
- fi
fi
# Unconditional check for compiler __thread support
@@ -2032,6 +2026,17 @@ fi
if test "$pie" = "no"; then
QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS"
+elif test "$static" = "yes"; then
+ if compile_prog "-fPIE -DPIE" "-static-pie"; then
+ QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
+ LDFLAGS="-static-pie $LDFLAGS"
+ pie="yes"
+ elif test "$pie" = "yes"; then
+ error_exit "-static-pie not available due to missing toolchain support"
+ else
+ LDFLAGS="-static $LDFLAGS"
+ pie="no"
+ fi
elif compile_prog "-fPIE -DPIE" "-pie"; then
QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
LDFLAGS="-pie $LDFLAGS"
Recent toolchains support static and pie at the same time. As with normal dynamic builds, allow --static to default to PIE if supported by the toolchain. Allow --enable/--disable-pie to override the default. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- configure | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) -- 2.20.1