qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2]  configure: Avoid warnings on OSX
@ 2016-06-18 22:05 Peter Maydell
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Peter Maydell @ 2016-06-18 22:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Stefan Weil

From: Peter Maydell <peter.maydell@linaro.org>

This patchset fixes a couple of minor issues with configure
tests that result in configure printing out warning messages
as it runs on OSX. (The warnings don't result in configure
actually failing.) Both reported by Stefan Weil.

Peter Maydell (2):
  configure: Improve usermode relocation linker option probe
  configure: Make AVX2 test robust to non-ELF systems

 configure | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

-- 
2.6.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe
  2016-06-18 22:05 [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell
@ 2016-06-18 22:05 ` Peter Maydell
  2016-06-19  5:47   ` Stefan Weil
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems Peter Maydell
  2016-06-28 15:07 ` [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell
  2 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2016-06-18 22:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Stefan Weil

From: Peter Maydell <peter.maydell@linaro.org>

The probe we do to determine what flags to use to make the usermode
executables use a non-default text address has some flaws:
 * we run it even if we're not building the user binaries
 * we don't expect "ld --verbose" to fail

The combination of these two results in a harmless but
ugly "ld: unknown option: --verbose" message when running
configure on OSX.

Improve the probe to only run when we need it and to fail
nicely when even the backstop 'ld --verbose' approach fails.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 10cb212..7beefcd 100755
--- a/configure
+++ b/configure
@@ -4700,7 +4700,7 @@ if test "$cpu" = "s390x" ; then
 fi
 
 # Probe for the need for relocating the user-only binary.
-if test "$pie" = "no" ; then
+if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
   textseg_addr=
   case "$cpu" in
     arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
@@ -4722,6 +4722,16 @@ EOF
       # In case ld does not support -Ttext-segment, edit the default linker
       # script via sed to set the .text start addr.  This is needed on FreeBSD
       # at least.
+      if ! $ld --verbose >/dev/null 2>&1; then
+        error_exit \
+            "We need to link the QEMU user mode binaries at a" \
+            "specific text address. Unfortunately your linker" \
+            "doesn't support either the -Ttext-segment option or" \
+            "printing the default linker script with --verbose." \
+            "If you don't want the user mode binaries, pass the" \
+            "--disable-user option to configure."
+      fi
+
       $ld --verbose | sed \
         -e '1,/==================================================/d' \
         -e '/==================================================/,$d' \
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems
  2016-06-18 22:05 [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe Peter Maydell
@ 2016-06-18 22:05 ` Peter Maydell
  2016-06-19  5:53   ` Stefan Weil
  2016-06-28 15:07 ` [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell
  2 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2016-06-18 22:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Stefan Weil

From: Peter Maydell <peter.maydell@linaro.org>

The AVX2 optimization test assumes that the object format
is ELF and the system has the readelf utility. If this isn't
true then configure might fail or emit a warning (since in
a pipe "foo | bar >/dev/null 2>&1" does not redirect the
stderr of foo, only of bar). Adjust the check so that if
we don't have readelf or don't have an ELF object then we
just don't enable the AVX2 optimization.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 7beefcd..30bca55 100755
--- a/configure
+++ b/configure
@@ -1792,8 +1792,10 @@ int foo(void *a) __attribute__((ifunc("bar_ifunc")));
 int main(int argc, char *argv[]) { return foo(argv[0]);}
 EOF
 if compile_object "" ; then
-    if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then
-        avx2_opt="yes"
+    if has readelf; then
+        if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
+            avx2_opt="yes"
+        fi
     fi
 fi
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe Peter Maydell
@ 2016-06-19  5:47   ` Stefan Weil
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Weil @ 2016-06-19  5:47 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches

Am 19.06.2016 um 00:05 schrieb Peter Maydell:
> From: Peter Maydell <peter.maydell@linaro.org>
> 
> The probe we do to determine what flags to use to make the usermode
> executables use a non-default text address has some flaws:
>  * we run it even if we're not building the user binaries
>  * we don't expect "ld --verbose" to fail
> 
> The combination of these two results in a harmless but
> ugly "ld: unknown option: --verbose" message when running
> configure on OSX.
> 
> Improve the probe to only run when we need it and to fail
> nicely when even the backstop 'ld --verbose' approach fails.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  configure | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 10cb212..7beefcd 100755
> --- a/configure
> +++ b/configure
> @@ -4700,7 +4700,7 @@ if test "$cpu" = "s390x" ; then
>  fi
>  
>  # Probe for the need for relocating the user-only binary.
> -if test "$pie" = "no" ; then
> +if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
>    textseg_addr=
>    case "$cpu" in
>      arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
> @@ -4722,6 +4722,16 @@ EOF
>        # In case ld does not support -Ttext-segment, edit the default linker
>        # script via sed to set the .text start addr.  This is needed on FreeBSD
>        # at least.
> +      if ! $ld --verbose >/dev/null 2>&1; then
> +        error_exit \
> +            "We need to link the QEMU user mode binaries at a" \
> +            "specific text address. Unfortunately your linker" \
> +            "doesn't support either the -Ttext-segment option or" \
> +            "printing the default linker script with --verbose." \
> +            "If you don't want the user mode binaries, pass the" \
> +            "--disable-user option to configure."
> +      fi
> +
>        $ld --verbose | sed \
>          -e '1,/==================================================/d' \
>          -e '/==================================================/,$d' \
> 

Reviewed-by: Stefan Weil <sw@weilnetz.de>

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems Peter Maydell
@ 2016-06-19  5:53   ` Stefan Weil
  2016-06-19  9:41     ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2016-06-19  5:53 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches

Am 19.06.2016 um 00:05 schrieb Peter Maydell:
> From: Peter Maydell <peter.maydell@linaro.org>
> 
> The AVX2 optimization test assumes that the object format
> is ELF and the system has the readelf utility. If this isn't
> true then configure might fail or emit a warning (since in
> a pipe "foo | bar >/dev/null 2>&1" does not redirect the
> stderr of foo, only of bar). Adjust the check so that if
> we don't have readelf or don't have an ELF object then we
> just don't enable the AVX2 optimization.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  configure | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index 7beefcd..30bca55 100755
> --- a/configure
> +++ b/configure
> @@ -1792,8 +1792,10 @@ int foo(void *a) __attribute__((ifunc("bar_ifunc")));
>  int main(int argc, char *argv[]) { return foo(argv[0]);}
>  EOF
>  if compile_object "" ; then
> -    if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then
> -        avx2_opt="yes"
> +    if has readelf; then
> +        if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
> +            avx2_opt="yes"
> +        fi
>      fi
>  fi
>  
> 

You could check "has readelf" earlier and avoid the compile test
if there is no readelf (saves a little time).

The final I/O redirection is still needed (otherwise Linux users will
see the grep output).

Regards
Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems
  2016-06-19  5:53   ` Stefan Weil
@ 2016-06-19  9:41     ` Peter Maydell
  2016-06-19 11:19       ` Stefan Weil
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2016-06-19  9:41 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Peter Maydell, QEMU Developers, Patch Tracking

On 19 June 2016 at 06:53, Stefan Weil <sw@weilnetz.de> wrote:
> Am 19.06.2016 um 00:05 schrieb Peter Maydell:
>> From: Peter Maydell <peter.maydell@linaro.org>
>>
>> The AVX2 optimization test assumes that the object format
>> is ELF and the system has the readelf utility. If this isn't
>> true then configure might fail or emit a warning (since in
>> a pipe "foo | bar >/dev/null 2>&1" does not redirect the
>> stderr of foo, only of bar). Adjust the check so that if
>> we don't have readelf or don't have an ELF object then we
>> just don't enable the AVX2 optimization.
>>
>> Reported-by: Stefan Weil <sw@weilnetz.de>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  configure | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 7beefcd..30bca55 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1792,8 +1792,10 @@ int foo(void *a) __attribute__((ifunc("bar_ifunc")));
>>  int main(int argc, char *argv[]) { return foo(argv[0]);}
>>  EOF
>>  if compile_object "" ; then
>> -    if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then
>> -        avx2_opt="yes"
>> +    if has readelf; then
>> +        if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
>> +            avx2_opt="yes"
>> +        fi
>>      fi
>>  fi
>>
>>
>
> You could check "has readelf" earlier and avoid the compile test
> if there is no readelf (saves a little time).

I guess so, though there's not much in it.

> The final I/O redirection is still needed (otherwise Linux users will
> see the grep output).

I added -q which should suppress that, no ?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems
  2016-06-19  9:41     ` Peter Maydell
@ 2016-06-19 11:19       ` Stefan Weil
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Weil @ 2016-06-19 11:19 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Peter Maydell, QEMU Developers, Patch Tracking

Am 19.06.2016 um 11:41 schrieb Peter Maydell:
> On 19 June 2016 at 06:53, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 19.06.2016 um 00:05 schrieb Peter Maydell:
>>> From: Peter Maydell <peter.maydell@linaro.org>
>>>
>>> The AVX2 optimization test assumes that the object format
>>> is ELF and the system has the readelf utility. If this isn't
>>> true then configure might fail or emit a warning (since in
>>> a pipe "foo | bar >/dev/null 2>&1" does not redirect the
>>> stderr of foo, only of bar). Adjust the check so that if
>>> we don't have readelf or don't have an ELF object then we
>>> just don't enable the AVX2 optimization.
>>>
>>> Reported-by: Stefan Weil <sw@weilnetz.de>
>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>> ---
>>>  configure | 6 ++++--
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 7beefcd..30bca55 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1792,8 +1792,10 @@ int foo(void *a) __attribute__((ifunc("bar_ifunc")));
>>>  int main(int argc, char *argv[]) { return foo(argv[0]);}
>>>  EOF
>>>  if compile_object "" ; then
>>> -    if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then
>>> -        avx2_opt="yes"
>>> +    if has readelf; then
>>> +        if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
>>> +            avx2_opt="yes"
>>> +        fi
>>>      fi
>>>  fi
>>>
>>>
>>
>> You could check "has readelf" earlier and avoid the compile test
>> if there is no readelf (saves a little time).
> 
> I guess so, though there's not much in it.
> 
>> The final I/O redirection is still needed (otherwise Linux users will
>> see the grep output).
> 
> I added -q which should suppress that, no ?
> 
> thanks
> -- PMM
> 

Sorry, I missed that detail.

Reviewed-by: Stefan Weil <sw@weilnetz.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX
  2016-06-18 22:05 [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe Peter Maydell
  2016-06-18 22:05 ` [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems Peter Maydell
@ 2016-06-28 15:07 ` Peter Maydell
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2016-06-28 15:07 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Stefan Weil, Patch Tracking

On 18 June 2016 at 23:05, Peter Maydell <pmaydell@chiark.greenend.org.uk> wrote:
> From: Peter Maydell <peter.maydell@linaro.org>
>
> This patchset fixes a couple of minor issues with configure
> tests that result in configure printing out warning messages
> as it runs on OSX. (The warnings don't result in configure
> actually failing.) Both reported by Stefan Weil.
>
> Peter Maydell (2):
>   configure: Improve usermode relocation linker option probe
>   configure: Make AVX2 test robust to non-ELF systems
>
>  configure | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)

Applied to master, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-06-28 15:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-18 22:05 [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell
2016-06-18 22:05 ` [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe Peter Maydell
2016-06-19  5:47   ` Stefan Weil
2016-06-18 22:05 ` [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems Peter Maydell
2016-06-19  5:53   ` Stefan Weil
2016-06-19  9:41     ` Peter Maydell
2016-06-19 11:19       ` Stefan Weil
2016-06-28 15:07 ` [Qemu-devel] [PATCH 0/2] configure: Avoid warnings on OSX Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).