Skip to content

Commit 8224df3

Browse files
authored
Merge pull request #38913 from akyrtzi/link-with-demangle-along-with-support
[cmake/AddSwift] When `support` is passed for LLVM_LINK_COMPONENTS also implicitly include `demangle`
2 parents 53d65b0 + dea7f9f commit 8224df3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,13 @@ function(add_swift_host_library name)
485485
message(FATAL_ERROR "One of SHARED/STATIC/OBJECT must be specified")
486486
endif()
487487
488+
# Using `support` llvm component ends up adding `-Xlinker /path/to/lib/libLLVMDemangle.a`
489+
# to `LINK_FLAGS` but `libLLVMDemangle.a` is not added as an input to the linking ninja statement.
490+
# As a workaround, include `demangle` component whenever `support` is mentioned.
491+
if("support" IN_LIST ASHL_LLVM_LINK_COMPONENTS)
492+
list(APPEND ASHL_LLVM_LINK_COMPONENTS "demangle")
493+
endif()
494+
488495
if(XCODE)
489496
get_filename_component(base_dir ${CMAKE_CURRENT_SOURCE_DIR} NAME)
490497
@@ -794,6 +801,12 @@ function(add_swift_host_tool executable)
794801
precondition(ASHT_SWIFT_COMPONENT
795802
MESSAGE "Swift Component is required to add a host tool")
796803
804+
# Using `support` llvm component ends up adding `-Xlinker /path/to/lib/libLLVMDemangle.a`
805+
# to `LINK_FLAGS` but `libLLVMDemangle.a` is not added as an input to the linking ninja statement.
806+
# As a workaround, include `demangle` component whenever `support` is mentioned.
807+
if("support" IN_LIST ASHT_LLVM_LINK_COMPONENTS)
808+
list(APPEND ASHT_LLVM_LINK_COMPONENTS "demangle")
809+
endif()
797810
798811
add_executable(${executable} ${ASHT_UNPARSED_ARGUMENTS})
799812
_add_host_variant_c_compile_flags(${executable})

0 commit comments

Comments
 (0)