[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 7/7] configure: Support -static-pie if requested
From: |
Alex Bennée |
Subject: |
Re: [PATCH v2 7/7] configure: Support -static-pie if requested |
Date: |
Tue, 07 Jan 2020 13:45:43 +0000 |
User-agent: |
mu4e 1.3.6; emacs 28.0.50 |
Richard Henderson <address@hidden> writes:
> 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 <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
> ---
> v2: Fix --disable-pie --static
> ---
> configure | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/configure b/configure
> index f6ff079fab..55586c5498 100755
> --- a/configure
> +++ b/configure
> @@ -1024,7 +1024,6 @@ for opt do
> ;;
> --static)
> static="yes"
> - LDFLAGS="-static $LDFLAGS"
> QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
> ;;
> --mandir=*) mandir="$optarg"
> @@ -2000,11 +1999,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
> @@ -2035,7 +2029,18 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then
> LDFLAGS_NOPIE="-no-pie"
> fi
>
> -if test "$pie" = "no"; then
> +if test "$static" = "yes"; then
> + if test "$pie" != "no" && 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 test "$pie" = "no"; then
> QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
> LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS"
> elif compile_prog "-fPIE -DPIE" "-pie"; then
--
Alex Bennée
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v2 7/7] configure: Support -static-pie if requested,
Alex Bennée <=