Message ID | 1447082049-25099-1-git-send-email-peter.maydell@linaro.org |
---|---|
State | Accepted |
Headers | show |
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
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
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 ##########################################
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(+) -- 2.6.2