Christian Weisgerber <[email protected]> writes:

> Greg Steuck:
>
>> Yes, it does rely on us shipping lld on amd64 which is the only platform
>> with lang/ghc.
>
> lld is the default linker on amd64!  You don't even need -fuse-ld=lld.

Indeed, so the patch below is even better. I rebuilt a few more
binaries. Looks like a uniform improvement from:

-rwxr-xr-x  1 root  bin  40.7M Jan 14 13:10 /usr/local/bin/darcs
-rwxr-xr-x  1 root  bin  84.6M Jan 14 09:37 /usr/local/bin/git-annex
-rwxr-xr-x  1 root  bin  37.1M Jan 14 13:49 /usr/local/bin/hledger
-rwxr-xr-x  1 root  bin  23.5M Jan 14 15:26 /usr/local/bin/shellcheck
-rwxr-xr-x  1 root  bin  36.2M Jan 14 12:38 /usr/local/bin/xmobar
-rwxr-xr-x  1 root  bin   3.4M Jan 13 15:24 /usr/local/bin/xmonad

to:

-rwxr-xr-x  1 _pbuild  _pbuild  21.9M Jan 24 22:03 
/usr/ports/pobj/darcs-2.16.5/darcs-2.16.5/dist-newstyle/build/x86_64-openbsd/ghc-9.2.5/darcs-2.16.5/build/darcs/darcs
-rwxr-xr-x  1 _pbuild  _pbuild  46.8M Jan 24 21:56 
/usr/ports/pobj/git-annex-10.20221103/git-annex-10.20221103/dist-newstyle/build/x86_64-openbsd/ghc-9.2.5/git-annex-10.20221103/build/git-annex/git-annex
-rwxr-xr-x  1 _pbuild  _pbuild  21.0M Jan 24 21:24 
/usr/ports/pobj/hledger-1.27.1/hledger-1.27.1/dist-newstyle/build/x86_64-openbsd/ghc-9.2.5/hledger-1.27.1/x/hledger/build/hledger/hledger
-rwxr-xr-x  1 _pbuild  _pbuild   9.3M Jan 24 21:31 
/usr/ports/pobj/shellcheck-0.9.0/ShellCheck-0.9.0/dist-newstyle/build/x86_64-openbsd/ghc-9.2.5/ShellCheck-0.9.0/x/shellcheck/build/shellcheck/shellcheck
-rwxr-xr-x  1 _pbuild  _pbuild  13.3M Jan 24 21:16 
/usr/ports/pobj/xmobar-0.43/xmobar-0.43/dist-newstyle/build/x86_64-openbsd/ghc-9.2.5/xmobar-0.43/x/xmobar/build/xmobar/xmobar
-rwxr-xr-x  1 _pbuild  _pbuild   3.9M Jan 24 21:09 
/usr/ports/pobj/xmonad-0.17.0/xmonad-0.17.0/dist-newstyle/build/x86_64-openbsd/ghc-9.2.5/xmonad-0.17.0/x/xmonad/build/xmonad/xmonad

Should I crank up revision for them all so we can easily tell which side
people are on should things go wrong?

Thanks
Greg

>From 6449280dd7829fe70efe9607a1acc983fb37550a Mon Sep 17 00:00:00 2001
From: Greg Steuck <[email protected]>
Date: Mon, 23 Jan 2023 09:11:17 -0800
Subject: [PATCH] Shrink Haskell binaries size via link time deduplication

http://brandon.si/code/linking-smaller-haskell-binaries/
---
 devel/cabal/cabal.port.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/devel/cabal/cabal.port.mk b/devel/cabal/cabal.port.mk
index 8e0ed30d9e8..f90e6ce59cf 100644
--- a/devel/cabal/cabal.port.mk
+++ b/devel/cabal/cabal.port.mk
@@ -85,6 +85,10 @@ MODCABAL_post-extract += \
        && echo "packages: ${WRKDIR}/${_package}-${_version}/${_package}.cabal" 
>> ${WRKSRC}/cabal.project.local
 .endfor  # MODCABAL_MANIFEST
 
+MODCABAL_post-extract += \
+       && echo "package *\n ghc-options: -split-sections\n" >> 
${WRKSRC}/cabal.project.local \
+       && echo "package ${MODCABAL_STEM}\n ld-options: 
-Wl,--gc-sections,--build-id" >> ${WRKSRC}/cabal.project.local
+
 # Automatically copies the cabal.project file if any.
 MODCABAL_post-extract += \
        && (test -f ${FILESDIR}/cabal.project \
-- 
2.39.0

Reply via email to