git: f4ff747cb709 - stable/13 - Remove TableGen objects from libllvm, fixing bad option registrations

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 01 Dec 2025 11:58:11 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=f4ff747cb709efeed3c1867060a81ae3ee72d474

commit f4ff747cb709efeed3c1867060a81ae3ee72d474
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-11-28 18:12:01 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-12-01 11:57:17 +0000

    Remove TableGen objects from libllvm, fixing bad option registrations
    
    In 986e05bc2a18 I revamped the build for all the llvm subprojects. Among
    others I added objects under contrib/llvm-project/llvm/lib/TableGen, but
    I missed that upstream explicitly removes these when building the shared
    llvm library:
    
    https://github.com/llvm/llvm-project/blob/llvmorg-19.1.7/llvm/tools/llvm-shlib/CMakeLists.txt#L23
    
    In 2e47f35be5dc I converted libllvm to a shared library. From that point
    onwards, some of the global command line option objects registered in
    llvm/lib/TableGen/Main.cpp conflict with similar objects in tools like
    llvm-cov, llvm-as, etc.
    
    This results in an error when running these tools: "CommandLine Error:
    Option 'o' registered more than once!", followed by a fatal exit.
    
    Fix this by removing the TableGen objects from libllvm. Note that we no
    longer install any of the tblgen binaries, these are only used during
    buildworld, and then in a statically linked form.
    
    PR:             291233
    MFC after:      3 days
    
    (cherry picked from commit 9978553d0199e7ec0bdd1c44fc7f6c7b0c11e43b)
---
 lib/clang/libllvm/Makefile | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile
index cb16d39961ae..2060f5f52c91 100644
--- a/lib/clang/libllvm/Makefile
+++ b/lib/clang/libllvm/Makefile
@@ -1246,16 +1246,6 @@ SRCS_MIN+=	Support/regexec.c
 SRCS_MIN+=	Support/regfree.c
 SRCS_MIN+=	Support/regstrlcpy.c
 SRCS_MIN+=	Support/xxhash.cpp
-SRCS_MIN+=	TableGen/DetailedRecordsBackend.cpp
-SRCS_MIN+=	TableGen/Error.cpp
-SRCS_MIN+=	TableGen/JSONBackend.cpp
-SRCS_MIN+=	TableGen/Main.cpp
-SRCS_MIN+=	TableGen/Record.cpp
-SRCS_MIN+=	TableGen/SetTheory.cpp
-SRCS_MIN+=	TableGen/StringMatcher.cpp
-SRCS_MIN+=	TableGen/TGLexer.cpp
-SRCS_MIN+=	TableGen/TGParser.cpp
-SRCS_MIN+=	TableGen/TableGenBackend.cpp
 .if ${MK_LLVM_TARGET_AARCH64} != "no"
 SRCS_MIN+=	Target/AArch64/AArch64A53Fix835769.cpp
 SRCS_MIN+=	Target/AArch64/AArch64A57FPLoadBalancing.cpp