qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
@ 2015-05-29 10:56 Alex Bennée
  2015-05-29 11:12 ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2015-05-29 10:56 UTC (permalink / raw)
  To: qemu-trivial; +Cc: Alex Bennée, qemu-devel

If your trying to debug and want to force -O0 then don't allow the
configure script to try and set -O2. You can use --enable-debug but that
enables a lot more stuff by default.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index b707429..be1f354 100755
--- a/configure
+++ b/configure
@@ -4240,7 +4240,10 @@ if test "$gcov" = "yes" ; then
   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
 elif test "$debug" = "no" ; then
-  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
+    if test "${EXTRA_CFLAGS#*-O}" = "$EXTRA_CFLAGS"; then
+        CFLAGS="-O2 $CFLAGS"
+    fi
+    CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
 fi
 
 ##########################################
-- 
2.4.1

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-05-29 10:56 [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O Alex Bennée
@ 2015-05-29 11:12 ` Paolo Bonzini
  2015-05-29 14:14   ` Alex Bennée
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2015-05-29 11:12 UTC (permalink / raw)
  To: Alex Bennée, qemu-trivial; +Cc: qemu-devel



On 29/05/2015 12:56, Alex Bennée wrote:
> If your trying to debug and want to force -O0 then don't allow the
> configure script to try and set -O2. You can use --enable-debug but that
> enables a lot more stuff by default.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index b707429..be1f354 100755
> --- a/configure
> +++ b/configure
> @@ -4240,7 +4240,10 @@ if test "$gcov" = "yes" ; then
>    CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>  elif test "$debug" = "no" ; then
> -  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
> +    if test "${EXTRA_CFLAGS#*-O}" = "$EXTRA_CFLAGS"; then
> +        CFLAGS="-O2 $CFLAGS"
> +    fi
> +    CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>  fi
>  
>  ##########################################
> 

Why aren't EXTRA_CFLAGS applied _after_ CFLAGS instead of before?

Paolo

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-05-29 11:12 ` Paolo Bonzini
@ 2015-05-29 14:14   ` Alex Bennée
  2015-05-29 16:29     ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2015-05-29 14:14 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-trivial, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> On 29/05/2015 12:56, Alex Bennée wrote:
>> If your trying to debug and want to force -O0 then don't allow the
>> configure script to try and set -O2. You can use --enable-debug but that
>> enables a lot more stuff by default.
>> 
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  configure | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/configure b/configure
>> index b707429..be1f354 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4240,7 +4240,10 @@ if test "$gcov" = "yes" ; then
>>    CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
>>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
>>  elif test "$debug" = "no" ; then
>> -  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>> +    if test "${EXTRA_CFLAGS#*-O}" = "$EXTRA_CFLAGS"; then
>> +        CFLAGS="-O2 $CFLAGS"
>> +    fi
>> +    CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>>  fi
>>  
>>  ##########################################
>> 
>
> Why aren't EXTRA_CFLAGS applied _after_ CFLAGS instead of before?

You mean just do:

diff --git a/configure b/configure
index b707429..f13831a 100755
--- a/configure
+++ b/configure
@@ -353,7 +353,7 @@ for opt do
   ;;
   --cpu=*) cpu="$optarg"
   ;;
-  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
+  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
                     EXTRA_CFLAGS="$optarg"
   ;;
   --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"

>
> Paolo

I guess at the time I was trying to be clean and avoiding multiple -O
calls. But I guess that will have the same effect.

-- 
Alex Bennée

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-05-29 14:14   ` Alex Bennée
@ 2015-05-29 16:29     ` Paolo Bonzini
  2015-06-02  5:48       ` Michael Tokarev
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2015-05-29 16:29 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-trivial, qemu-devel



On 29/05/2015 16:14, Alex Bennée wrote:
> You mean just do:
> 
> diff --git a/configure b/configure
> index b707429..f13831a 100755
> --- a/configure
> +++ b/configure
> @@ -353,7 +353,7 @@ for opt do
>    ;;
>    --cpu=*) cpu="$optarg"
>    ;;
> -  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
> +  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
>                      EXTRA_CFLAGS="$optarg"
>    ;;
>    --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
> 
> I guess at the time I was trying to be clean and avoiding multiple -O
> calls. But I guess that will have the same effect.

Yes, that.  Most other QEMU_CFLAGS assignments add at the beginning, so
I guess the remaining ones (including the --extra-cflags one) should too.

Paolo

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-05-29 16:29     ` Paolo Bonzini
@ 2015-06-02  5:48       ` Michael Tokarev
  2015-06-02  8:01         ` Alex Bennée
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Tokarev @ 2015-06-02  5:48 UTC (permalink / raw)
  To: Paolo Bonzini, Alex Bennée; +Cc: qemu-trivial, qemu-devel

29.05.2015 19:29, Paolo Bonzini wrote:
> On 29/05/2015 16:14, Alex Bennée wrote:
>> You mean just do:
>>
>> diff --git a/configure b/configure
>> index b707429..f13831a 100755
>> --- a/configure
>> +++ b/configure
>> @@ -353,7 +353,7 @@ for opt do
>>    ;;
>>    --cpu=*) cpu="$optarg"
>>    ;;
>> -  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
>> +  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
>>                      EXTRA_CFLAGS="$optarg"
>>    ;;
>>    --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
>>
>> I guess at the time I was trying to be clean and avoiding multiple -O
>> calls. But I guess that will have the same effect.
> 
> Yes, that.  Most other QEMU_CFLAGS assignments add at the beginning, so
> I guess the remaining ones (including the --extra-cflags one) should too.

So, what's the final version of this patch?

Thanks,

/mjt

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-06-02  5:48       ` Michael Tokarev
@ 2015-06-02  8:01         ` Alex Bennée
  2015-06-02 14:08           ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2015-06-02  8:01 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-trivial, Paolo Bonzini, qemu-devel


Michael Tokarev <mjt@tls.msk.ru> writes:

> 29.05.2015 19:29, Paolo Bonzini wrote:
>> On 29/05/2015 16:14, Alex Bennée wrote:
>>> You mean just do:
>>>
>>> diff --git a/configure b/configure
>>> index b707429..f13831a 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -353,7 +353,7 @@ for opt do
>>>    ;;
>>>    --cpu=*) cpu="$optarg"
>>>    ;;
>>> -  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
>>> +  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
>>>                      EXTRA_CFLAGS="$optarg"
>>>    ;;
>>>    --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
>>>
>>> I guess at the time I was trying to be clean and avoiding multiple -O
>>> calls. But I guess that will have the same effect.
>> 
>> Yes, that.  Most other QEMU_CFLAGS assignments add at the beginning, so
>> I guess the remaining ones (including the --extra-cflags one) should too.
>
> So, what's the final version of this patch?

I can send the second patch but I'm wary about changing all instances to
QEMU_CFLAGS to append additional flags.

>
> Thanks,
>
> /mjt

-- 
Alex Bennée

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-06-02  8:01         ` Alex Bennée
@ 2015-06-02 14:08           ` Paolo Bonzini
  2015-06-03  8:57             ` Alex Bennée
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2015-06-02 14:08 UTC (permalink / raw)
  To: Alex Bennée, Michael Tokarev; +Cc: qemu-trivial, qemu-devel



On 02/06/2015 10:01, Alex Bennée wrote:
> 
> Michael Tokarev <mjt@tls.msk.ru> writes:
> 
>> 29.05.2015 19:29, Paolo Bonzini wrote:
>>> On 29/05/2015 16:14, Alex Bennée wrote:
>>>> You mean just do:
>>>>
>>>> diff --git a/configure b/configure
>>>> index b707429..f13831a 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -353,7 +353,7 @@ for opt do
>>>>    ;;
>>>>    --cpu=*) cpu="$optarg"
>>>>    ;;
>>>> -  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
>>>> +  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
>>>>                      EXTRA_CFLAGS="$optarg"
>>>>    ;;
>>>>    --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
>>>>
>>>> I guess at the time I was trying to be clean and avoiding multiple -O
>>>> calls. But I guess that will have the same effect.
>>>
>>> Yes, that.  Most other QEMU_CFLAGS assignments add at the beginning, so
>>> I guess the remaining ones (including the --extra-cflags one) should too.
>>
>> So, what's the final version of this patch?
> 
> I can send the second patch but I'm wary about changing all instances to
> QEMU_CFLAGS to append additional flags.

Sure, that's a separate change.

Paolo

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

* Re: [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O
  2015-06-02 14:08           ` Paolo Bonzini
@ 2015-06-03  8:57             ` Alex Bennée
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Bennée @ 2015-06-03  8:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-trivial, Michael Tokarev, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> On 02/06/2015 10:01, Alex Bennée wrote:
>> 
>> Michael Tokarev <mjt@tls.msk.ru> writes:
>> 
>>> 29.05.2015 19:29, Paolo Bonzini wrote:
>>>> On 29/05/2015 16:14, Alex Bennée wrote:
>>>>> You mean just do:
>>>>>
>>>>> diff --git a/configure b/configure
>>>>> index b707429..f13831a 100755
>>>>> --- a/configure
>>>>> +++ b/configure
>>>>> @@ -353,7 +353,7 @@ for opt do
>>>>>    ;;
>>>>>    --cpu=*) cpu="$optarg"
>>>>>    ;;
>>>>> -  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
>>>>> +  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
>>>>>                      EXTRA_CFLAGS="$optarg"
>>>>>    ;;
>>>>>    --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
>>>>>
>>>>> I guess at the time I was trying to be clean and avoiding multiple -O
>>>>> calls. But I guess that will have the same effect.
>>>>
>>>> Yes, that.  Most other QEMU_CFLAGS assignments add at the beginning, so
>>>> I guess the remaining ones (including the --extra-cflags one) should too.
>>>
>>> So, what's the final version of this patch?
>> 
>> I can send the second patch but I'm wary about changing all instances to
>> QEMU_CFLAGS to append additional flags.
>
> Sure, that's a separate change.

Cool, sent to qemu-trvial: "[PATCH] configure: postfix --extra-cflags to QEMU_CFLAGS"

>
> Paolo

-- 
Alex Bennée

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

end of thread, other threads:[~2015-06-03  8:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 10:56 [Qemu-devel] [PATCH] configure: don't apply -O2 if extra-cflags sets -O Alex Bennée
2015-05-29 11:12 ` Paolo Bonzini
2015-05-29 14:14   ` Alex Bennée
2015-05-29 16:29     ` Paolo Bonzini
2015-06-02  5:48       ` Michael Tokarev
2015-06-02  8:01         ` Alex Bennée
2015-06-02 14:08           ` Paolo Bonzini
2015-06-03  8:57             ` Alex Bennée

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).