configure: Don't disable optimization for non-fortify builds
PATCH 1/1 configure: Don't disable optimization for non-fortify builds
Commit b553a0428014636bc inadvertently disabled optimization for all non-fortify builds. Fix this bug so we only do an unoptimized build if we want debug.
--- configure | 2 ++ 1 file changed, 2 insertions(+)
configure +2 -0
@@ -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 ##########################################
Signature · 1 line
2.6.2
Quoted 14 lines · Peter Maydell
Commit
b553a0428014636bcinadvertently 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 <[email protected]>--- configure | 2 ++ 1 file changed, 2 insertions(+)configure +0
-0
configure if test "$gcov" = "yes" ; then · line 4456
Quoted 6 lines
configure +2
-0@@ -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
Quoted 2 lines
configure +0
-0##########################################
Quoted 36 lines · Paolo Bonzini
Quoted 14 lines · Peter Maydell
Commit
b553a0428014636bcinadvertently 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 <[email protected]>--- configure | 2 ++ 1 file changed, 2 insertions(+)configure +0
-0configure if test "$gcov" = "yes" ; then · line 4456
Quoted 6 lines
configure +2
-0@@ -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" fiI 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
Quoted 1 line
... 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
Quoted 37 lines · Peter Maydell
Quoted 36 lines · Paolo Bonzini
Quoted 14 lines · Peter Maydell
Commit
b553a0428014636bcinadvertently 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 <[email protected]>--- configure | 2 ++ 1 file changed, 2 insertions(+)configure +0
-0configure if test "$gcov" = "yes" ; then · line 4456
Quoted 6 lines
configure +2
-0@@ -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" fiI 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
Quoted 7 lines
Quoted 1 line
... so that --enable-debug does not disable
_FORTIFY_SOURCE.Commit
b553a04280146specifically sets fortify_source=no in the handling of the --enable-debug option, so John obviously intended that it should disable_FORTIFY_SOURCE. Thefeature_test_macros(7)manpage says_FORTIFY_SOURCEonly 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
Peter Maydell
AppliedQuoted 2 lines · Paolo Bonzini
You're right. The two are the same then, preference is of course subjective. Feel free to commit yours!
Applied to master, thanks.
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Paolo Bonzini
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
Quoted 10 lines · Peter Maydell
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Peter Maydell
Commit
b553a0428014636bcinadvertently disabled optimization for all non-fortify builds. Fix this bug so we only do an unoptimized build if we want debug.
Quoted 5 lines
Commit
b553a04280146specifically sets fortify_source=no in the handling of the --enable-debug option, so John obviously intended that it should disable_FORTIFY_SOURCE. Thefeature_test_macros(7)manpage says_FORTIFY_SOURCEonly 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.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 36 lines · Paolo Bonzini
Quoted 14 lines · Peter Maydell
Commit
b553a0428014636bcinadvertently 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 <[email protected]>--- configure | 2 ++ 1 file changed, 2 insertions(+)configure +0
-0configure if test "$gcov" = "yes" ; then · line 4456
Quoted 6 lines
configure +2
-0@@ -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" fiI 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
Quoted 6 lines
... so that --enable-debug does not disable
_FORTIFY_SOURCE.Paolo
Quoted 2 lines
configure +0
-0##########################################
I was trying to maintain the behavior before my clang/ccache fixes where --enable-debug did indeed disable _FORTIFY_SOURCE.
--js