From af9d73d52d0864b3f8b1ff223e543f9b09e291f7 Mon Sep 17 00:00:00 2001 From: PHO Date: Tue, 6 Mar 2012 09:01:42 +0900 Subject: [PATCH] It turned out that gcc -Os was sufficient to reduce the stage0's .text size under 64 MiB so the costly dead-code elimination was not needed. --- files/bootstrap-bsd.mk | 8 ++++++++ files/bootstrap.mk | 6 ++++++ stage0.mk | 16 +--------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/files/bootstrap-bsd.mk b/files/bootstrap-bsd.mk index aa46508..6ddd580 100644 --- a/files/bootstrap-bsd.mk +++ b/files/bootstrap-bsd.mk @@ -19,3 +19,11 @@ utils/ghc-pkg_dist-install_v_EXTRA_CC_OPTS += -L[[PREFIX]]/lib -lm -liconv -luti SRC_CC_OPTS += -I[[PREFIX]]/include INTEGER_LIBRARY = integer-simple + +# Unregisterised stage0 compiler gets too large (.text section being +# over 64 MiB) without -Os, exceeding NetBSD/i386's kernel default +# limitation. +# Note that stage1 currently doesn't bloat that much (about 42.6 +# MiB), but when it does we have to append CONF_CC_OPTS_STAGE1="-Os" +# to CONFIGURE_ENV as well. I guess that's a matter of time :( +EXTRA_CC_OPTS += -Os diff --git a/files/bootstrap.mk b/files/bootstrap.mk index 64f5fd5..e20f79a 100644 --- a/files/bootstrap.mk +++ b/files/bootstrap.mk @@ -19,3 +19,9 @@ utils/ghc-pkg_dist-install_v_EXTRA_CC_OPTS += -L[[PREFIX]]/lib -lm -liconv -lncu SRC_CC_OPTS += -I[[PREFIX]]/include INTEGER_LIBRARY = integer-simple + +# Unregisterised stage0 compiler runs way too slow without GCC's +# optimisation. The stage1 (which is also unregisterised) is still +# slow, but then we have to append CONF_CC_OPTS_STAGE1="-O2" to +# CONFIGURE_ENV as well. +EXTRA_CC_OPTS += -O2 diff --git a/stage0.mk b/stage0.mk index ca96244..d66415a 100644 --- a/stage0.mk +++ b/stage0.mk @@ -75,21 +75,7 @@ ${WRKDIR}/stamp-extract-hc: ${WRKDIR}/stamp-configure-hc-boot ${WRKDIR}/stamp-rewrite-hc-paths: ${WRKDIR}/stamp-extract-hc ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \ ${PHASE_MSG} "Rewriting source paths in bootstrapping compiler for ${PKGNAME}" && \ - ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk -.if ${MACHINE_ARCH} == "i386" && ${OPSYS} == "NetBSD" -# Unregisterised stage0 compiler gets too large (.text section being -# over 64 MiB) without dead-code elimination, exceeding NetBSD/i386's -# kernel default limitation. -# Note that stage1 currently doesn't bloat that much (about 42.6 -# MiB), but when it does we have to append -# CONF_CC_OPTS_STAGE1="-fdata..." and -# CONF_GCC_LINKER_OPTS_STAGE1="-Wl,--gc-sections" to CONFIGURE_ENV as -# well. I guess that's a matter of time :( - ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \ - ${ECHO} "EXTRA_CC_OPTS += -fdata-sections -ffunction-sections" >> mk/build.mk && \ - ${ECHO} "EXTRA_CC_OPTS += -Wl,--gc-sections" >> mk/build.mk -.endif - ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \ + ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk && \ for c in libraries/*/configure; do \ (cd `${DIRNAME} $$c` && ${SETENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \ done && \ -- 2.40.0