git: 630b03a1d314 - main - devel/mold: Update to 2.32.0

From: Ashish SHUKLA <ashish_at_FreeBSD.org>
Date: Tue, 16 Jul 2024 06:07:59 UTC
The branch main has been updated by ashish:

URL: https://cgit.FreeBSD.org/ports/commit/?id=630b03a1d314008abd2c7b9e4c2f4195eb3e3a77

commit 630b03a1d314008abd2c7b9e4c2f4195eb3e3a77
Author:     Daniel Engberg <dizzy@FreeBSD.org>
AuthorDate: 2024-07-14 15:31:12 +0000
Commit:     Ashish SHUKLA <ashish@FreeBSD.org>
CommitDate: 2024-07-16 06:07:01 +0000

    devel/mold: Update to 2.32.0
    
    - Add test target
    - Add option for LTO
    
    PR:             279617
    Approved by:    maintainer
---
 devel/mold/Makefile | 67 ++++++++++++++++++++++++++++++++++++++++++-----------
 devel/mold/distinfo |  6 ++---
 2 files changed, 56 insertions(+), 17 deletions(-)

diff --git a/devel/mold/Makefile b/devel/mold/Makefile
index 7883fa74eeaf..47b49e7bc6dc 100644
--- a/devel/mold/Makefile
+++ b/devel/mold/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	mold
-DISTVERSIONPREFIX=  v
-DISTVERSION=	2.31.0
-PORTREVISION=	2
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.32.0
 CATEGORIES=	devel
 
 MAINTAINER=	ashish@FreeBSD.org
@@ -16,12 +15,27 @@ NOT_FOR_ARCHS=	armhf armv7 i386
 LIB_DEPENDS=	libmimalloc.so:devel/mimalloc \
 		libtbb.so:devel/onetbb \
 		libzstd.so:archivers/zstd
+TEST_DEPENDS=	bash:shells/bash \
+		gcc${GCC_DEFAULT}:lang/gcc${GCC_DEFAULT} \
+		ggrep:textproc/gnugrep \
+		${LOCALBASE}/bin/readelf:devel/binutils
 
-USES=		cmake ssl localbase:ldflags
+USES=		cmake:testing compiler:c++20-lang localbase:ldflags shebangfix
+SHEBANG_FILES=	test/elf/*.sh
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	rui314
 
+PLIST_FILES=	bin/ld.mold \
+		bin/mold \
+		lib/mold/mold-wrapper.so \
+		libexec/mold/ld \
+		share/man/man1/ld.mold.1.gz \
+		share/man/man1/mold.1.gz
+
+
+CMAKE_TESTING_OFF=	MOLD_ENABLE_QEMU_TESTS
+
 CMAKE_ON=	MOLD_USE_MIMALLOC \
 		MOLD_USE_SYSTEM_MIMALLOC \
 		MOLD_USE_SYSTEM_TBB
@@ -29,19 +43,44 @@ CMAKE_ON=	MOLD_USE_MIMALLOC \
 CMAKE_OFF=	MOLD_USE_MOLD \
 		MOLD_USE_TSAN \
 		MOLD_MOSTLY_STATIC \
-		BUILD_TESTING \
-		MOLD_LTO
+		BUILD_TESTING
 
-OPTIONS_DEFINE= ASAN
+OPTIONS_DEFINE=	ASAN LTO
+
+ASAN_DESC=	Enable Address Sanitizer
 
-ASAN_DESC= 	Enable Address Sanitizer
 ASAN_CMAKE_BOOL=MOLD_USE_ASAN
 
-PLIST_FILES=	bin/ld.mold \
-		bin/mold \
-		lib/mold/mold-wrapper.so \
-		libexec/mold/ld \
-		share/man/man1/ld.mold.1.gz \
-		share/man/man1/mold.1.gz
+LTO_CMAKE_BOOL=	MOLD_LTO
+
+pre-test:
+	### BINARY_ALIAS doesn't work for tests so we need to fix it manually
+	@${REINPLACE_CMD} -e 's|OBJCOPY=objcopy|OBJCOPY=${PREFIX}/bin/objcopy|g' \
+	    ${PATCH_WRKSRC}/test/elf/common.inc
+	@${REINPLACE_CMD} -e 's|OBJDUMP=objdump|OBJDUMP=${PREFIX}/bin/objdump|g' \
+	    ${PATCH_WRKSRC}/test/elf/common.inc
+	@${REINPLACE_CMD} -e 's|$$GCC |gcc${GCC_DEFAULT} |g' \
+	    ${PATCH_WRKSRC}/test/elf/*.sh
+	@${REINPLACE_CMD} -e 's|gcc |gcc${GCC_DEFAULT} |g' \
+	    ${PATCH_WRKSRC}/test/elf/*.sh
+	@${REINPLACE_CMD} -e 's|grep -|${PREFIX}/bin/ggrep -|g' \
+	    ${PATCH_WRKSRC}/test/elf/*.sh
+	@${REINPLACE_CMD} -e 's|readelf |${PREFIX}/bin/readelf |g' \
+	    ${PATCH_WRKSRC}/test/elf/*.sh
+	### Depends on LLVMgold plugin which isn't built by binutils
+	@${RM} ${WRKSRC}/test/elf/defsym-lto.sh
+	@${RM} ${WRKSRC}/test/elf/lto-archive.sh
+	@${RM} ${WRKSRC}/test/elf/lto-archive2.sh
+	@${RM} ${WRKSRC}/test/elf/lto-dso.sh
+	@${RM} ${WRKSRC}/test/elf/lto-version-script.sh
+	@${RM} ${WRKSRC}/test/elf/symbol-version-lto.sh
+	### These tests errors out with "Unsupported relocation type 36 in non-PLT relocations"
+	@${RM} ${WRKSRC}/test/elf/tlsdesc.sh
+	@${RM} ${WRKSRC}/test/elf/tlsdesc-dlopen.sh
+	@${RM} ${WRKSRC}/test/elf/tlsdesc-initial-exec.sh
+	@${RM} ${WRKSRC}/test/elf/tlsdesc-local-dynamic.sh
+	@${RM} ${WRKSRC}/test/elf/wrap-lto.sh
+	@${RM} ${WRKSRC}/test/elf/x86_64_tlsdesc.sh
+	@${RM} ${WRKSRC}/test/elf/x86_64_tls-module-base.sh
 
 .include <bsd.port.mk>
diff --git a/devel/mold/distinfo b/devel/mold/distinfo
index 31ffd1797b6e..630cb59978e8 100644
--- a/devel/mold/distinfo
+++ b/devel/mold/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1714749682
-SHA256 (rui314-mold-v2.31.0_GH0.tar.gz) = 3dc3af83a5d22a4b29971bfad17261851d426961c665480e2ca294e5c74aa1e5
-SIZE (rui314-mold-v2.31.0_GH0.tar.gz) = 10031469
+TIMESTAMP = 1717938067
+SHA256 (rui314-mold-v2.32.0_GH0.tar.gz) = 4b7e4146ea0f52be9adae8b417399f3676a041e65b55e3f25f088120d30a320b
+SIZE (rui314-mold-v2.32.0_GH0.tar.gz) = 10005686