Martijn van Beurden wrote:> op 25-07-14 19:32, Scott Brown schreef: > > ./configure -enable-static -disable-shared CFLAGS=" -isysroot > > /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" > > make > > Well, the use of CFLAGS 'disables' the -O3 and unroll-loops > optimisation. I'm quite sure that's the culprit. Add -O3 to your > CFLAGS and it should be fixed. > > See the following lines in the configure script > > > if test "x$user_cflags" = x; then > > CFLAGS="-O3 -funroll-loops -Wall -W -Winline" > > fi > > Maybe we should change this 'overriding' behaviour of CFLAGS and > add -O3 just like most other options are added to the CFLAGS?Wow, I didn't even know that was there. I have now replaced the above with: CFLAGS="-O3 -funroll-loops -Wall -W -Winline $CFLAGS" so CFLAGS are preserved and enforce optimisations. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:> Wow, I didn't even know that was there. > > I have now replaced the above with: > > CFLAGS="-O3 -funroll-loops -Wall -W -Winline $CFLAGS" > > so CFLAGS are preserved and enforce optimisations.I just built FLAC and noticed that the size of flac.exe is noticeably bigger, so I compared the generated Makefiles before ang after this change. The difference is: "-g -O2" options were added to CFLAGS. before: CFLAGS = -O3 -funroll-loops -Wall -W -Winline -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Wunreachable-code -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -msse2 -Wextra after: CFLAGS = -O3 -funroll-loops -Wall -W -Winline -g -O2 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Wunreachable-code -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -msse2 -Wextra
lvqcl wrote:> I just built FLAC and noticed that the size of flac.exe is noticeably bigger, > so I compared the generated Makefiles before ang after this change. > > The difference is: "-g -O2" options were added to CFLAGS. > > before: > CFLAGS = -O3 -funroll-loops -Wall -W -Winline -Wall -Wextra -Wstrict-prototypes > -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow > -Wundef -Wmissing-declarations -Wunreachable-code -Wdeclaration-after-statement > -D_FORTIFY_SOURCE=2 -msse2 -Wextra > > after: > CFLAGS = -O3 -funroll-loops -Wall -W -Winline -g -O2 -Wall -Wextra > -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align > -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Wunreachable-code > -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -msse2 -WextraWell -g asks the compiler to add debug symbols. What hapens if you strip the binary? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
On Sat, Jul 26, 2014 at 06:29:36PM +1000, Erik de Castro Lopo wrote:> Martijn van Beurden wrote: > > See the following lines in the configure script > > > > > if test "x$user_cflags" = x; then > > > CFLAGS="-O3 -funroll-loops -Wall -W -Winline" > > > fi > > > > Maybe we should change this 'overriding' behaviour of CFLAGS and > > add -O3 just like most other options are added to the CFLAGS? > > Wow, I didn't even know that was there. > > I have now replaced the above with: > > CFLAGS="-O3 -funroll-loops -Wall -W -Winline $CFLAGS" > > so CFLAGS are preserved and enforce optimisations.Well, this reverts the commit 18e0154. How is the user supposed to set CFLAGS without getting -O3 -funroll-loops there? (e.g. to minimize the size of the compiled binaries) -- Miroslav Lichvar
Miroslav Lichvar wrote:> Well, this reverts the commit 18e0154. How is the user supposed to set > CFLAGS without getting -O3 -funroll-loops there? (e.g. to minimize the > size of the compiled binaries)Is it -O3 or -funroll-loops that you have a problem with? Or both? What would you prefer to see as the default optimisation level? I'm sure there is a solution to this. Lets find it. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/