Many years ago a patch was added to the then-current llvm port, contained in file files/patch-freebsd-r352318. This patch has been carried forward to every new llvm port. As far as I can tell the underlying bug was fixed around LLVM 10. Since at least LLVM 14, and likely since LLVM 10, this patch introduces a bug by reverting a bug fix. The llvm test suite (llvm-lit llvm/test) does not pass with it applied. The patch was added because a particular file in the arm64 kernel crashed the compiler. I was able to compile and boot an arm64 kernel using llvm16 after removing files/patch-freebsd-r352318. Going forward the LLVM regression tests should pass before a ports change is committed.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=c0b0bd52bbdaa97445caa0dab3a9f8b5815b227c commit c0b0bd52bbdaa97445caa0dab3a9f8b5815b227c Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-05-30 18:46:28 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-05-30 18:48:50 +0000 devel/llvm16: remove obsolete patch PR: 271616 Reported by: jfc@mit.edu MFH: 2023Q2 devel/llvm16/Makefile | 2 +- devel/llvm16/files/patch-freebsd-r352318 (gone) | 93 ------------------------- 2 files changed, 1 insertion(+), 94 deletions(-)
A commit in branch 2023Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=988341a91ee816a7a2c3be367ef0d16605857da3 commit 988341a91ee816a7a2c3be367ef0d16605857da3 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-05-30 18:46:28 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2023-06-10 00:58:00 +0000 devel/llvm16: remove obsolete patch PR: 271616 Reported by: jfc@mit.edu (cherry picked from commit c0b0bd52bbdaa97445caa0dab3a9f8b5815b227c) devel/llvm16/Makefile | 2 +- devel/llvm16/files/patch-freebsd-r352318 (gone) | 93 ------------------------- 2 files changed, 1 insertion(+), 94 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=f67260aafd1cfb5eb91cfc72df80a00ef8b87e13 commit f67260aafd1cfb5eb91cfc72df80a00ef8b87e13 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-06-19 18:44:05 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-06-19 18:44:05 +0000 devel/llvm15: arm fixes, lite default change Change the lite flavor to default to BE_FREEBSD rather than BE_NATIVE to allow its use in cross-build CI pipelines. Backport fix for LLVM bug 61396. [0] This fixes miscompilation of gcc on 32-bit arm. Remove an obsolete patch which breaks arm64. [1] PR: 271992 [0], 271616 [1] Reported by: jfc@mit.edu [0,1] devel/llvm15/Makefile | 4 +- devel/llvm15/files/patch-backport-962c306a1 (new) | 42 ++++++++++ devel/llvm15/files/patch-freebsd-r352318 (gone) | 93 ----------------------- 3 files changed, 44 insertions(+), 95 deletions(-)
A commit in branch 2023Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=880ad3b00f273d47831d183ac44f3b3074d0875a commit 880ad3b00f273d47831d183ac44f3b3074d0875a Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-06-19 18:44:05 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-06-23 21:01:37 +0000 devel/llvm15: arm fixes, lite default change Change the lite flavor to default to BE_FREEBSD rather than BE_NATIVE to allow its use in cross-build CI pipelines. Backport fix for LLVM bug 61396. [0] This fixes miscompilation of gcc on 32-bit arm. Remove an obsolete patch which breaks arm64. [1] PR: 271992 [0], 271616 [1] Reported by: jfc@mit.edu [0,1] (cherry picked from commit f67260aafd1cfb5eb91cfc72df80a00ef8b87e13) devel/llvm15/Makefile | 4 +- devel/llvm15/files/patch-backport-962c306a1 (new) | 42 ++++++++++ devel/llvm15/files/patch-freebsd-r352318 (gone) | 93 ----------------------- 3 files changed, 44 insertions(+), 95 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=391873c7b9a02d9fdb5cce4dc79630ec3320702c commit 391873c7b9a02d9fdb5cce4dc79630ec3320702c Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-07-12 18:59:33 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-07-12 19:00:55 +0000 devel/llvm13: arm and aarch64 improvements 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. Remove an obsolete patch which breaks arm64. [0] When BE_NATIVE is specified on aarch64, include the ARM (32-bit) backend. PR: 271616 [0] Reported by: jfc@mit.edu [0] devel/llvm13/Makefile | 4 +- devel/llvm13/files/patch-backport-3450272fc2 (new) | 32 ++++++++ devel/llvm13/files/patch-freebsd-r352318 (gone) | 93 ---------------------- 3 files changed, 34 insertions(+), 95 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3dcb15dfa4563a0f31828de6db9162d932c259a5 commit 3dcb15dfa4563a0f31828de6db9162d932c259a5 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-07-12 18:19:10 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-07-12 19:00:55 +0000 devel/llvm14: arm and aarch64 improvements 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. Remove an obsolete patch which breaks arm64. [0] When BE_NATIVE is specified on aarch64, include the ARM (32-bit) backend. PR: 271616 [0] Reported by: jfc@mit.edu [0] devel/llvm14/Makefile | 4 +- devel/llvm14/files/patch-backport-3450272fc2 (new) | 32 ++++++++ devel/llvm14/files/patch-freebsd-r352318 (gone) | 93 ---------------------- 3 files changed, 34 insertions(+), 95 deletions(-)
A commit in branch 2023Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=e086c6a53f3442fb5af0d308cdeca9cf4beac544 commit e086c6a53f3442fb5af0d308cdeca9cf4beac544 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-07-12 18:59:33 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-07-20 18:33:45 +0000 devel/llvm13: arm and aarch64 improvements 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. Remove an obsolete patch which breaks arm64. [0] When BE_NATIVE is specified on aarch64, include the ARM (32-bit) backend. PR: 271616 [0] Reported by: jfc@mit.edu [0] (cherry picked from commit 391873c7b9a02d9fdb5cce4dc79630ec3320702c) devel/llvm13/Makefile | 4 +- devel/llvm13/files/patch-backport-3450272fc2 (new) | 32 ++++++++ devel/llvm13/files/patch-freebsd-r352318 (gone) | 93 ---------------------- 3 files changed, 34 insertions(+), 95 deletions(-)
A commit in branch 2023Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3d5ad388afdb38e0f6229acfc8c1fa88160a9fb0 commit 3d5ad388afdb38e0f6229acfc8c1fa88160a9fb0 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-07-12 18:19:10 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-07-20 18:33:45 +0000 devel/llvm14: arm and aarch64 improvements 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. Remove an obsolete patch which breaks arm64. [0] When BE_NATIVE is specified on aarch64, include the ARM (32-bit) backend. PR: 271616 [0] Reported by: jfc@mit.edu [0] (cherry picked from commit 3dcb15dfa4563a0f31828de6db9162d932c259a5) devel/llvm14/Makefile | 4 +- devel/llvm14/files/patch-backport-3450272fc2 (new) | 32 ++++++++ devel/llvm14/files/patch-freebsd-r352318 (gone) | 93 ---------------------- 3 files changed, 34 insertions(+), 95 deletions(-)
I could hypothetically remove this patch further back, but it doesn't seem worth the effort at this point so I'll stop at llvm13 unless I get an explicit request.