diff mbox series

[PULL,12/13] configure: Add -Werror to PIE probe

Message ID 20200407155118.20139-13-alex.bennee@linaro.org
State New
Headers show
Series [PULL,01/13] .github: Enable repo-lockdown bot to refuse GitHub pull requests | expand

Commit Message

Alex Bennée April 7, 2020, 3:51 p.m. UTC
From: Richard Henderson <richard.henderson@linaro.org>

Without -Werror, the probe may succeed, but then compilation fails
later when -Werror is added for other reasons.  Shows up on windows,
where the compiler complains about -fPIC.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200401214756.6559-1-richard.henderson@linaro.org>
Message-Id: <20200403191150.863-13-alex.bennee@linaro.org>

Comments

Mark Cave-Ayland April 7, 2020, 4:08 p.m. UTC | #1
On 07/04/2020 16:51, Alex Bennée wrote:

> From: Richard Henderson <richard.henderson@linaro.org>
> 
> Without -Werror, the probe may succeed, but then compilation fails
> later when -Werror is added for other reasons.  Shows up on windows,
> where the compiler complains about -fPIC.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Message-Id: <20200401214756.6559-1-richard.henderson@linaro.org>
> Message-Id: <20200403191150.863-13-alex.bennee@linaro.org>
> 
> diff --git a/configure b/configure
> index 22870f38672..233c671aaa9 100755
> --- a/configure
> +++ b/configure
> @@ -2119,7 +2119,7 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then
>  fi
>  
>  if test "$static" = "yes"; then
> -  if test "$pie" != "no" && compile_prog "-fPIE -DPIE" "-static-pie"; then
> +  if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
>      QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
>      QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
>      pie="yes"
> @@ -2132,7 +2132,7 @@ if test "$static" = "yes"; then
>  elif test "$pie" = "no"; then
>    QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
>    QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
> -elif compile_prog "-fPIE -DPIE" "-pie"; then
> +elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
>    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
>    QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
>    pie="yes"

Note that even with this build fix, the native and cross-compiled Windows binaries
crash upon startup unless --disable-pie is explicitly passed to configure (this seems
like an unexpected side-effect of d2cd29e307: "configure: Do not force pie=no for
non-x86").

Given that users such as Howard and https://bugs.launchpad.net/bugs/1870911 are
starting to notice, would it be best to set this configure option as the default for
Windows builds for now?


ATB,

Mark.
Richard Henderson April 7, 2020, 4:25 p.m. UTC | #2
On 4/7/20 9:08 AM, Mark Cave-Ayland wrote:
> Given that users such as Howard and https://bugs.launchpad.net/bugs/1870911 are
> starting to notice, would it be best to set this configure option as the default for
> Windows builds for now?

I guess so.

I'm mildly annoyed that Howard's compiler is silently accepting -fPIE and then
producing incorrect code, rather than rejecting -fPIE as the docker win32
cross-compiler is doing.


r~
diff mbox series

Patch

diff --git a/configure b/configure
index 22870f38672..233c671aaa9 100755
--- a/configure
+++ b/configure
@@ -2119,7 +2119,7 @@  if compile_prog "-Werror -fno-pie" "-no-pie"; then
 fi
 
 if test "$static" = "yes"; then
-  if test "$pie" != "no" && compile_prog "-fPIE -DPIE" "-static-pie"; then
+  if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
     QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
     pie="yes"
@@ -2132,7 +2132,7 @@  if test "$static" = "yes"; then
 elif test "$pie" = "no"; then
   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
-elif compile_prog "-fPIE -DPIE" "-pie"; then
+elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
   pie="yes"