Skip to content

Commit d22b348

Browse files
committed
cmake: add a workaround to rdar://77839981
1 parent e12148a commit d22b348

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Diff for: cmake/modules/AddSwift.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ function(add_swift_host_library name)
464464
SHARED
465465
STATIC
466466
OBJECT
467-
PURE_SWIFT)
467+
PURE_SWIFT
468+
HAS_LIBSWIFT)
468469
set(single_parameter_options)
469470
set(multiple_parameter_options
470471
LLVM_LINK_COMPONENTS)
@@ -510,6 +511,12 @@ function(add_swift_host_library name)
510511

511512
add_library(${name} ${libkind} ${ASHL_SOURCES})
512513

514+
if (ASHL_HAS_LIBSWIFT AND SWIFT_TOOLS_ENABLE_LIBSWIFT)
515+
# Workaround for a linker crash related to autolinking: rdar://77839981
516+
set_property(TARGET ${name} APPEND_STRING PROPERTY
517+
LINK_FLAGS " -lobjc ")
518+
endif()
519+
513520
# Respect LLVM_COMMON_DEPENDS if it is set.
514521
#
515522
# LLVM_COMMON_DEPENDS if a global variable set in ./lib that provides targets

Diff for: tools/libSwiftScan/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ set(LLVM_EXPORTED_SYMBOL_FILE
99

1010
add_swift_host_library(libSwiftScan SHARED
1111
libSwiftScan.cpp
12-
c-include-check.c)
12+
c-include-check.c
13+
HAS_LIBSWIFT)
1314

1415
add_dependencies(libSwiftScan
1516
clang

0 commit comments

Comments
 (0)