[Lldb-commits] [lldb] 369cbcc - [lldb] include `LLVMTargetParser` in `LINK_COMPONENTS` (#145606)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 25 11:30:54 PDT 2025


Author: Andrew Rogers
Date: 2025-06-25T19:30:50+01:00
New Revision: 369cbcc1a21ab07ea6ca142a3b87c75d0a1b2014

URL: https://github.com/llvm/llvm-project/commit/369cbcc1a21ab07ea6ca142a3b87c75d0a1b2014
DIFF: https://github.com/llvm/llvm-project/commit/369cbcc1a21ab07ea6ca142a3b87c75d0a1b2014.diff

LOG: [lldb] include `LLVMTargetParser` in `LINK_COMPONENTS` (#145606)

## Purpose
Fix duplicate symbol definition errors when building LLDB `HostTests`
against a LLVM Windows DLL.

## Background 
When building LLDB `HostTests` against LLVM built as a Windows DLL,
compilation fails due to multiple duplicate symbol definition errors.
This is because symbols are both exported by the LLVM Windows DLL and
the `LLVMTargetParser` library.

## Overview
The issue is resolved by adding `LLVMTargetParser` (e.g. `TargetParser`)
to `LINK_COMPONENTS`, which adds it to `LLVM_LINK_COMPONENTS`, rather
than `LINK_LIBS`, which links directly against the library. This change
makes it behave correctly when linking against a static or dynamic LLVM.

Added: 
    

Modified: 
    lldb/unittests/Host/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Host/CMakeLists.txt b/lldb/unittests/Host/CMakeLists.txt
index 3b20f1d723d18..5591edda38aca 100644
--- a/lldb/unittests/Host/CMakeLists.txt
+++ b/lldb/unittests/Host/CMakeLists.txt
@@ -37,7 +37,9 @@ add_lldb_unittest(HostTests
     lldbUtilityHelpers
     lldbHostHelpers
     LLVMTestingSupport
-    LLVMTargetParser
+
+  LINK_COMPONENTS
+    TargetParser
   )
 
 add_subdirectory(common)


        


More information about the lldb-commits mailing list