All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
@ 2015-11-09 15:14 Peter Maydell
  2015-11-09 15:28 ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2015-11-09 15:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, John Snow, patches

Commit b553a0428014636bc inadvertently disabled optimization
for all non-fortify builds. Fix this bug so we only do an
unoptimized build if we want debug.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index b687764..46fd8bd 100755
--- a/configure
+++ b/configure
@@ -4451,6 +4451,8 @@ if test "$gcov" = "yes" ; then
   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
 elif test "$fortify_source" = "yes" ; then
   CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
+elif test "$debug" = "no"; then
+  CFLAGS="-O2 $CFLAGS"
 fi
 
 ##########################################
-- 
2.6.2

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 15:14 [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds Peter Maydell
@ 2015-11-09 15:28 ` Paolo Bonzini
  2015-11-09 15:31   ` Peter Maydell
  2015-11-09 16:38   ` John Snow
  0 siblings, 2 replies; 8+ messages in thread
From: Paolo Bonzini @ 2015-11-09 15:28 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: John Snow, patches



On 09/11/2015 16:14, Peter Maydell wrote:
> Commit b553a0428014636bc inadvertently disabled optimization
> for all non-fortify builds. Fix this bug so we only do an
> unoptimized build if we want debug.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  configure | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/configure b/configure
> index b687764..46fd8bd 100755
> --- a/configure
> +++ b/configure
> @@ -4451,6 +4451,8 @@ if test "$gcov" = "yes" ; then
>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>  elif test "$fortify_source" = "yes" ; then
>    CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
> +elif test "$debug" = "no"; then
> +  CFLAGS="-O2 $CFLAGS"
>  fi

I think what was intended is:

if test "$gcov" = "yes" ; then
  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
elif test "$debug" = "no" ; then
  if test "$fortify_source" = "yes"; then
    CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
  fi
  CFLAGS="-O2 $CFLAGS"
fi

... so that --enable-debug does not disable _FORTIFY_SOURCE.

Paolo

>  ##########################################
> 

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 15:28 ` Paolo Bonzini
@ 2015-11-09 15:31   ` Peter Maydell
  2015-11-09 15:33     ` Paolo Bonzini
  2015-11-09 22:14     ` Eric Blake
  2015-11-09 16:38   ` John Snow
  1 sibling, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2015-11-09 15:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: John Snow, QEMU Developers, Patch Tracking

On 9 November 2015 at 15:28, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 09/11/2015 16:14, Peter Maydell wrote:
>> Commit b553a0428014636bc inadvertently disabled optimization
>> for all non-fortify builds. Fix this bug so we only do an
>> unoptimized build if we want debug.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  configure | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/configure b/configure
>> index b687764..46fd8bd 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4451,6 +4451,8 @@ if test "$gcov" = "yes" ; then
>>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>>  elif test "$fortify_source" = "yes" ; then
>>    CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>> +elif test "$debug" = "no"; then
>> +  CFLAGS="-O2 $CFLAGS"
>>  fi
>
> I think what was intended is:
>
> if test "$gcov" = "yes" ; then
>   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
>   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
> elif test "$debug" = "no" ; then
>   if test "$fortify_source" = "yes"; then
>     CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>   fi
>   CFLAGS="-O2 $CFLAGS"
> fi
>
> ... so that --enable-debug does not disable _FORTIFY_SOURCE.

Commit b553a04280146 specifically sets fortify_source=no
in the handling of the --enable-debug option, so John
obviously intended that it should disable _FORTIFY_SOURCE.
The feature_test_macros(7) manpage says _FORTIFY_SOURCE
only kicks in at -O1 and above anyway, so that makes sense.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 15:31   ` Peter Maydell
@ 2015-11-09 15:33     ` Paolo Bonzini
  2015-11-09 16:58       ` Peter Maydell
  2015-11-09 22:14     ` Eric Blake
  1 sibling, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2015-11-09 15:33 UTC (permalink / raw)
  To: Peter Maydell; +Cc: John Snow, QEMU Developers, Patch Tracking



On 09/11/2015 16:31, Peter Maydell wrote:
> On 9 November 2015 at 15:28, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>>
>> On 09/11/2015 16:14, Peter Maydell wrote:
>>> Commit b553a0428014636bc inadvertently disabled optimization
>>> for all non-fortify builds. Fix this bug so we only do an
>>> unoptimized build if we want debug.
>>>
>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>> ---
>>>  configure | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index b687764..46fd8bd 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -4451,6 +4451,8 @@ if test "$gcov" = "yes" ; then
>>>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>>>  elif test "$fortify_source" = "yes" ; then
>>>    CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>>> +elif test "$debug" = "no"; then
>>> +  CFLAGS="-O2 $CFLAGS"
>>>  fi
>>
>> I think what was intended is:
>>
>> if test "$gcov" = "yes" ; then
>>   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
>>   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>> elif test "$debug" = "no" ; then
>>   if test "$fortify_source" = "yes"; then
>>     CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>>   fi
>>   CFLAGS="-O2 $CFLAGS"
>> fi
>>
>> ... so that --enable-debug does not disable _FORTIFY_SOURCE.
> 
> Commit b553a04280146 specifically sets fortify_source=no
> in the handling of the --enable-debug option, so John
> obviously intended that it should disable _FORTIFY_SOURCE.
> The feature_test_macros(7) manpage says _FORTIFY_SOURCE
> only kicks in at -O1 and above anyway, so that makes sense.

You're right.  The two are the same then, preference is of course
subjective.  Feel free to commit yours!


Paolo

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 15:28 ` Paolo Bonzini
  2015-11-09 15:31   ` Peter Maydell
@ 2015-11-09 16:38   ` John Snow
  1 sibling, 0 replies; 8+ messages in thread
From: John Snow @ 2015-11-09 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Peter Maydell, qemu-devel; +Cc: patches



On 11/09/2015 10:28 AM, Paolo Bonzini wrote:
> 
> 
> On 09/11/2015 16:14, Peter Maydell wrote:
>> Commit b553a0428014636bc inadvertently disabled optimization
>> for all non-fortify builds. Fix this bug so we only do an
>> unoptimized build if we want debug.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  configure | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/configure b/configure
>> index b687764..46fd8bd 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4451,6 +4451,8 @@ if test "$gcov" = "yes" ; then
>>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>>  elif test "$fortify_source" = "yes" ; then
>>    CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>> +elif test "$debug" = "no"; then
>> +  CFLAGS="-O2 $CFLAGS"
>>  fi
> 
> I think what was intended is:
> 
> if test "$gcov" = "yes" ; then
>   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
>   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
> elif test "$debug" = "no" ; then
>   if test "$fortify_source" = "yes"; then
>     CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>   fi
>   CFLAGS="-O2 $CFLAGS"
> fi
> 
> ... so that --enable-debug does not disable _FORTIFY_SOURCE.
> 
> Paolo
> 
>>  ##########################################
>>

I was trying to maintain the behavior before my clang/ccache fixes where
--enable-debug did indeed disable _FORTIFY_SOURCE.

--js

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 15:33     ` Paolo Bonzini
@ 2015-11-09 16:58       ` Peter Maydell
  2015-11-12 15:30         ` Laurent Vivier
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2015-11-09 16:58 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: John Snow, QEMU Developers, Patch Tracking

On 9 November 2015 at 15:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
> You're right.  The two are the same then, preference is of course
> subjective.  Feel free to commit yours!

Applied to master, thanks.

-- PMM

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 15:31   ` Peter Maydell
  2015-11-09 15:33     ` Paolo Bonzini
@ 2015-11-09 22:14     ` Eric Blake
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Blake @ 2015-11-09 22:14 UTC (permalink / raw)
  To: Peter Maydell, Paolo Bonzini; +Cc: John Snow, QEMU Developers, Patch Tracking

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

On 11/09/2015 08:31 AM, Peter Maydell wrote:
> On 9 November 2015 at 15:28, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>>
>> On 09/11/2015 16:14, Peter Maydell wrote:
>>> Commit b553a0428014636bc inadvertently disabled optimization
>>> for all non-fortify builds. Fix this bug so we only do an
>>> unoptimized build if we want debug.
>>>

> 
> Commit b553a04280146 specifically sets fortify_source=no
> in the handling of the --enable-debug option, so John
> obviously intended that it should disable _FORTIFY_SOURCE.
> The feature_test_macros(7) manpage says _FORTIFY_SOURCE
> only kicks in at -O1 and above anyway, so that makes sense.

In fact, there are versions of glibc that noisily complain at -O0 if
_FORTIFY_SOURCE is enabled.  Disabling _FORTIFY_SOURCE when enabling
debug is correct.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds
  2015-11-09 16:58       ` Peter Maydell
@ 2015-11-12 15:30         ` Laurent Vivier
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2015-11-12 15:30 UTC (permalink / raw)
  To: Peter Maydell, Paolo Bonzini; +Cc: John Snow, QEMU Developers



On 09/11/2015 17:58, Peter Maydell wrote:
> On 9 November 2015 at 15:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> You're right.  The two are the same then, preference is of course
>> subjective.  Feel free to commit yours!
> 
> Applied to master, thanks.
> 
> -- PMM

When I run configure now, I've the following error:

No C++ compiler available; disabling C++ specific optional code
/home/lvivier/Projects/qemu/build/x86_64/../../configure: line 4438:
-dM: command not found

4438  elif echo | $cxx -dM -E - | grep __clang__ > /dev/null 2>&1 ; then

We should check if "$cxx" is defined before using it...

Laurent

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

end of thread, other threads:[~2015-11-12 15:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 15:14 [Qemu-devel] [PATCH for-2.5] configure: Don't disable optimization for non-fortify builds Peter Maydell
2015-11-09 15:28 ` Paolo Bonzini
2015-11-09 15:31   ` Peter Maydell
2015-11-09 15:33     ` Paolo Bonzini
2015-11-09 16:58       ` Peter Maydell
2015-11-12 15:30         ` Laurent Vivier
2015-11-09 22:14     ` Eric Blake
2015-11-09 16:38   ` John Snow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.