git: cbb0094aa11d - main - devel/llvm-{cheri,morello}: allow non-triple targets

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 17 Apr 2025 20:05:09 UTC
The branch main has been updated by brooks:

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

commit cbb0094aa11dda2e06aa264acfb6c19481ae100f
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-04-16 19:28:44 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-04-17 20:04:32 +0000

    devel/llvm-{cheri,morello}: allow non-triple targets
    
    aarch64 and aarch64-freebsd are both valid targets so remove all
    attempts to validate the target in the wrapper script and slightly
    expand the match for possible CHERI targets.
    
    Reported by:    jhb
    Suggestions from:       jrtc27
    Sponsored by:   DARPA, AFRL
---
 devel/llvm-cheri/Makefile                  |  2 +-
 devel/llvm-cheri/files/wrapper-cheri.sh.in | 14 +++-----------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/devel/llvm-cheri/Makefile b/devel/llvm-cheri/Makefile
index 733933c863e4..66c195ea5d11 100644
--- a/devel/llvm-cheri/Makefile
+++ b/devel/llvm-cheri/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 PORTVERSION=	${LLVM_MAJOR}.0.d${SNAPDATE}
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel lang
 PKGNAMESUFFIX=	${LLVM_SUFFIX}
 
diff --git a/devel/llvm-cheri/files/wrapper-cheri.sh.in b/devel/llvm-cheri/files/wrapper-cheri.sh.in
index a99decb9b056..113aacf20a5a 100644
--- a/devel/llvm-cheri/files/wrapper-cheri.sh.in
+++ b/devel/llvm-cheri/files/wrapper-cheri.sh.in
@@ -82,15 +82,7 @@ set_sysroot()
 
 set_target()
 {
-	local target="$1"
-	case "$target" in
-	*-*-*)
-		_TARGET="$target"
-		;;
-	*)
-		echo "malformed target triple: '$target'"
-		;;
-	esac
+	_TARGET="$1"
 }
 
 tool=$0
@@ -147,7 +139,7 @@ arch_objdump_flags=
 # than a misguided -mcpu flag.
 if [ $CHERIBSD_VERSION -gt 0 ]; then
 	case "$_TARGET" in
-	aarch64-*-freebsd*)
+	aarch64-*-freebsd*|aarch64-freebsd*)
 		if run_tool llvm-readelf -h ${_SYSROOT}/lib/libc.so.7 | grep "Flags:.*purecap" >/dev/null; then
 			tls_flags=
 			vararg_flags=
@@ -180,7 +172,7 @@ if [ $CHERIBSD_VERSION -gt 0 ]; then
 			arch_objdump_flags="--mattr=+morello"
 		fi
 		;;
-	riscv64-*-freebsd*)
+	riscv64-*-freebsd*|riscv64-freebsd*)
 		if run_tool llvm-readelf -h ${_SYSROOT}/lib/libc.so.7 | grep "Flags:.*cheriabi" >/dev/null; then
 			mabi=l64pc128d
 		else