git: e160923e2435 - 2023Q3 - devel/llvm16: change clang to allow -m32 on arm64

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 20 Jul 2023 19:55:44 UTC
The branch 2023Q3 has been updated by brooks:

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

commit e160923e24351c7d2280ad4cbe97795d5a262ba0
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-07-11 23:11:40 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-07-20 18:33:44 +0000

    devel/llvm16: change clang to allow -m32 on arm64
    
    This is a backport from upstream and will be merged to FreeBSD head
    soon.  See D40943 for more info.
    
    Sponsored by:   DARPA
    
    (cherry picked from commit 3509504bd820a16b91ee3ac6818aef8e7894fb2e)
---
 devel/llvm16/Makefile                        |  2 +-
 devel/llvm16/files/patch-backport-3450272fc2 | 33 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/devel/llvm16/Makefile b/devel/llvm16/Makefile
index 11ac69fbb456..7a70876d13e7 100644
--- a/devel/llvm16/Makefile
+++ b/devel/llvm16/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 DISTVERSION=	16.0.6
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel lang
 MASTER_SITES=	https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
 		https://${PRE_}releases.llvm.org/${LLVM_RELEASE}${RCDIR}/
diff --git a/devel/llvm16/files/patch-backport-3450272fc2 b/devel/llvm16/files/patch-backport-3450272fc2
new file mode 100644
index 000000000000..1af8bf9700a0
--- /dev/null
+++ b/devel/llvm16/files/patch-backport-3450272fc2
@@ -0,0 +1,33 @@
+commit 3450272fc281979388bb845a9fffb59b42cc2e7e
+Author: Jessica Clarke <jrtc27@jrtc27.com>
+Date:   Mon Jul 10 01:40:58 2023 +0100
+
+    [Driver][FreeBSD] Generalise lib32 handling to support arm
+    
+    The current code maintains its own list of 32-bit architectures for
+    which there is a 64-bit FreeBSD architecture that supports it for lib32.
+    This is unnecessary (if it's not supported, the directory just won't
+    exist), and means that, when FreeBSD gains lib32 support for a new
+    architecture, you need an updated toolchain that knows about it.
+    Instead we can check for any 32-bit architecture and have forwards
+    compatibility.
+    
+    This is motivated by FreeBSD adding support for building arm lib32
+    libraries on aarch64.
+    
+    Co-authored-by: Mike Karels <karels@FreeBSD.org>
+
+diff --git clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/FreeBSD.cpp
+index ac336598a78c..84e257741702 100644
+--- clang/lib/Driver/ToolChains/FreeBSD.cpp
++++ clang/lib/Driver/ToolChains/FreeBSD.cpp
+@@ -376,8 +376,7 @@ FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &Triple,
+ 
+   // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
+   // back to '/usr/lib' if it doesn't exist.
+-  if ((Triple.getArch() == llvm::Triple::x86 || Triple.isMIPS32() ||
+-       Triple.isPPC32()) &&
++  if (Triple.isArch32Bit() &&
+       D.getVFS().exists(concat(getDriver().SysRoot, "/usr/lib32/crt1.o")))
+     getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib32"));
+   else