From e91e502ab6424be12c3448431a65e7d617ab5571 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 11 May 2014 17:43:51 -0700 Subject: Make qmake also use -ffunction-sections This might lead to a smaller binary if we use --gc-sections too. Change-Id: I7e17b956a85ecefc3e187054848393d2855152b6 Reviewed-by: Oswald Buddenhagen --- configure | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'configure') diff --git a/configure b/configure index e7e4f4f59b..d4eb6d0dc0 100755 --- a/configure +++ b/configure @@ -3662,8 +3662,8 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; echo "########################################################################" >> "$mkfile" EXTRA_OBJS= EXTRA_SRCS= - EXTRA_CFLAGS="\$(QMAKE_CFLAGS)" - EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)" + EXTRA_CFLAGS="\$(QMAKE_CFLAGS) \$(QMAKE_CFLAGS_SPLIT_SECTIONS)" + EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)" EXTRA_LFLAGS="\$(QMAKE_LFLAGS)" if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then @@ -3674,7 +3674,9 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM" setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM" setBootstrapVariable QMAKE_CFLAGS + setBootstrapVariable QMAKE_CFLAGS_SPLIT_SECTIONS setBootstrapVariable QMAKE_CXXFLAGS + setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS setBootstrapVariable QMAKE_LFLAGS if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then -- cgit v1.2.3 From 6315745770384490509cf471c6286a1ea32cb79e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 May 2014 11:27:06 -0700 Subject: Strip bootstrapped binaries of unused sections This matches the -ffunction-sections from bootstrap.pro, which tells the compiler to create a section for each function. The -gc-sections option tells the linker to drop what wasn't used (normally, it only drops entire files). Before (on Linux, built with -O3, no LTO): text data bss dec hex filename 1746385 7920 3750 1758055 1ad367 bin/moc 1444101 6664 1894 1452659 162a73 bin/rcc 4407725 1568 4896 4414189 435aed bin/qmake After: text data bss dec hex filename 1131655 6520 3494 1141669 116ba5 bin/moc 1027043 5480 1766 1034289 fc831 bin/rcc 3578489 1656 5313 3585458 36b5b2 bin/qmake Gain: 35% on moc, 28% on rcc, 19% on qmake Before (on OS X): __TEXT __DATA __OBJC others dec hex 1495040 12288 0 4294993008 4296500336 100176470 bin/moc 1265664 8192 0 4294983904 4296257760 10013b0e0 bin/rcc 5279744 81920 0 4297912320 4303273984 1007ec000 bin/qmake After: __TEXT __DATA __OBJC others dec hex 806912 8192 0 4294988132 4295803236 1000cc164 bin/moc 720896 8192 0 4294979764 4295708852 1000b50b4 bin/rcc 4841472 77824 0 4295580688 4300499984 100546c10 bin/qmake Gain: 46% on moc, 43% on rcc, 8% on qmake. Change-Id: Icc7cdc9fd6f5db15537b4adabaac7e7a27e539d4 Reviewed-by: Oswald Buddenhagen --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index d4eb6d0dc0..d5c2b0801f 100755 --- a/configure +++ b/configure @@ -3664,7 +3664,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; EXTRA_SRCS= EXTRA_CFLAGS="\$(QMAKE_CFLAGS) \$(QMAKE_CFLAGS_SPLIT_SECTIONS)" EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)" - EXTRA_LFLAGS="\$(QMAKE_LFLAGS)" + EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)" if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then EXTRA_LFLAGS="$EXTRA_LFLAGS -lm" @@ -3678,6 +3678,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; setBootstrapVariable QMAKE_CXXFLAGS setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS setBootstrapVariable QMAKE_LFLAGS + setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then setBootstrapVariable QMAKE_CFLAGS_RELEASE -- cgit v1.2.3