qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 1.0] configure: build position independent ex


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v5 1.0] configure: build position independent executables across for x86 hosts
Date: Tue, 15 Nov 2011 09:10:40 +0000

On 15 November 2011 08:00, Avi Kivity <address@hidden> wrote:

> @@ -1099,6 +1099,37 @@ for flag in $gcc_flags; do
>     fi
>  done
>
> +if test "$pie" = "yes" -a "$static" = "yes" ; then
> +  echo "static and pie are mutually incompatible"
> +  exit 1
> +fi

The -a operator to test has been marked obsolescent in
POSIX -- please don't use it in new code. (Use
if test "$pie" = yes && test "$static" = yes; then )

> +if test "$pie" = "yes" ; then
> +  cat > $TMPC << EOF
> +int main(void) { return 0; }
> +EOF
> +  if compile_prog "-fPIE -DPIE" "-Wl,-pie"; then
> +    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
> +    LDFLAGS="-Wl,-pie $LDFLAGS"
> +    if compile_prog "-fPIE -DPIE" "-Wl,-pie -Wl,-z,relro -Wl,-z,now"; then
> +      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"

Why does this second compile test put -fPIE -DPIE into
its local cflags and -Wl,-pie into its local ldflags
when we just put them into the global cflags/ldflags?

> +    fi
> +  else
> +    echo "Disabling PIE due to missing toolchain support"
> +    pie="no"

This means that if the user explicitly asked for PIE (with
--enable-pie") we will carry on even if we couldn't do it.
Usually for configure if the user asked for something then
not providing it is a fatal error.

-- PMM



reply via email to

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