configure: don't apply -O2 if extra-cflags sets -O
PATCH 1/1 configure: don't apply -O2 if extra-cflags sets -O
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.
--- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
configure +4 -1
@@ -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 ##########################################
Signature · 1 line
2.4.1
Quoted 16 lines · Alex Bennée
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 <[email protected]>--- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)configure +0
-0@@ -4240,7 +4240,10 @@ if test "$gcov" = "yes" ; then CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
configure if test "$gcov" = "yes" ; then · line 4249
Quoted 10 lines
configure +4
-1LDFLAGS="-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
Quoted 25 lines · Paolo Bonzini
Quoted 24 lines · Alex Bennée
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 <[email protected]>--- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)configure +4
-1@@ -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
Quoted 4 lines
configure if test "$gcov" = "yes" ; then · line 4249
Quoted 2 lines
configure +0
-0##########################################Why aren't
EXTRA_CFLAGSapplied _after_ CFLAGS instead of before?
You mean just do:
configure +1 -1
@@ -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"
Quoted 2 lines
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.
Signature · 1 line
Alex Bennée
Quoted 16 lines · Alex Bennée
You mean just do:
configure +1
-1@@ -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"
Quoted 2 lines
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
Quoted 17 lines · Paolo Bonzini
Quoted 16 lines · Alex Bennée
You mean just do:
configure +1
-1@@ -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"
Quoted 5 lines
Quoted 2 lines
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_CFLAGSassignments 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
Quoted 18 lines · Michael Tokarev
Quoted 17 lines · Paolo Bonzini
Quoted 16 lines · Alex Bennée
You mean just do:
configure +1
-1@@ -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"
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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_CFLAGSassignments 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.
Quoted 4 lines
Thanks,
/mjt
Signature · 1 line
Alex Bennée
Quoted 27 lines · Alex Bennée
Quoted 24 lines · Michael Tokarev
Quoted 22 lines · Paolo Bonzini
Quoted 16 lines · Alex Bennée
You mean just do:
configure +1
-1@@ -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"Quoted 2 lines
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_CFLAGSassignments add at the beginning, so I guess the remaining ones (including the --extra-cflags one) should too.
Quoted 4 lines
Quoted 1 line
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_CFLAGSto append additional flags.
Sure, that's a separate change.
Paolo
Quoted 28 lines · Paolo Bonzini
Quoted 27 lines · Alex Bennée
Quoted 24 lines · Michael Tokarev
Quoted 22 lines · Paolo Bonzini
Quoted 16 lines · Alex Bennée
You mean just do:
configure +1
-1@@ -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"Quoted 2 lines
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_CFLAGSassignments add at the beginning, so I guess the remaining ones (including the --extra-cflags one) should too.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
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_CFLAGSto append additional flags.Sure, that's a separate change.
Cool, sent to qemu-trvial: "[PATCH] configure: postfix --extra-cflags to QEMU_CFLAGS"
Quoted 2 lines
Paolo
Signature · 1 line
Alex Bennée