Enable use of Link Time Optimizations in GCC.

This commit is contained in:
Moinak Ghosh 2012-12-11 17:58:23 +05:30
parent 42858c10a2
commit c7b960e72c
2 changed files with 10 additions and 3 deletions

View file

@ -147,9 +147,9 @@ DEBUG_RABIN_OPT = -O -fno-omit-frame-pointer
DEBUG_CPPFLAGS = $(COMMON_CPPFLAGS) DEBUG_CPPFLAGS = $(COMMON_CPPFLAGS)
DEBUG_FPTR_FLAG = DEBUG_FPTR_FLAG =
RELEASE_LINK = g++ -m64 -pthread -msse3 @LIBBSCGEN_OPT@ RELEASE_LINK = g++ -m64 -pthread -msse3 @LIBBSCGEN_OPT@ @LTO_FLAG@
RELEASE_COMPILE = gcc -m64 -msse3 -c RELEASE_COMPILE = gcc -m64 -msse3 -c @LTO_FLAG@
RELEASE_COMPILE_cpp = g++ -m64 -msse3 -c RELEASE_COMPILE_cpp = g++ -m64 -msse3 -c @LTO_FLAG@
RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS) RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS)
RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS) RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS)
RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG

7
config
View file

@ -46,6 +46,7 @@ yasm=yasm
keccak_srcs= keccak_srcs=
keccak_hdrs= keccak_hdrs=
keccak_srcs_asm= keccak_srcs_asm=
lto_flag=
# Try a simple compilation # Try a simple compilation
cat << _EOF > tst.c cat << _EOF > tst.c
@ -71,6 +72,10 @@ then
exit 1 exit 1
fi fi
# Check GCC version and enable LTO flags if possible
gcc -v 2>&1 | grep lto > /dev/null
[ $? -eq 0 ] && lto_flag="-flto"
# Check bitness of system # Check bitness of system
bitness=`./tst` bitness=`./tst`
rm -f tst tst.c rm -f tst tst.c
@ -344,6 +349,7 @@ sha256asmobjsvar="SHA256ASM_OBJS"
sha256objsvar="SHA256_OBJS" sha256objsvar="SHA256_OBJS"
yasmvar="YASM" yasmvar="YASM"
fptr_flag_var="FPTR_FLAG" fptr_flag_var="FPTR_FLAG"
lto_flag_var="LTO_FLAG"
openssllibdirvar="OPENSSL_LIBDIR" openssllibdirvar="OPENSSL_LIBDIR"
opensslincdirvar="OPENSSL_INCDIR" opensslincdirvar="OPENSSL_INCDIR"
@ -396,5 +402,6 @@ s#@${keccak_srcs_var}@#${keccak_srcs}#g
s#@${keccak_hdrs_var}@#${keccak_hdrs}#g s#@${keccak_hdrs_var}@#${keccak_hdrs}#g
s#@${keccak_srcs_var}@#${keccak_srcs}#g s#@${keccak_srcs_var}@#${keccak_srcs}#g
s#@${keccak_srcs_asm_var}@#${keccak_srcs_asm}#g s#@${keccak_srcs_asm_var}@#${keccak_srcs_asm}#g
s#@${lto_flag_var}@#${lto_flag}#g
" > Makefile " > Makefile