Skip to content

Commit 3e20817

Browse files
committed
Build workaround: only consider shims to be protected in Swift code on Darwin.
GNU ld seems to have problems with PC-relative references to protected functions that aren't calls. We'll generate that pattern in Swift code in release builds because of function merging. The workaround is to just not tell the compiler that these symbols can be addressed PC-relative when we might be using GNU ld, which I've conservatively approximated as "not Darwin" while I try to figure out what changed to cause this.
1 parent b198362 commit 3e20817

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmake/modules/SwiftSource.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ function(handle_swift_sources
7979
# <rdar://problem/15972329>
8080
list(APPEND swift_compile_flags "-force-single-frontend-invocation")
8181

82-
if(SWIFTSOURCES_IS_STDLIB_CORE)
82+
# FIXME: Apply this on all platforms where the linker supports it.
83+
if(SWIFTSOURCES_IS_STDLIB_CORE AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
8384
list(APPEND swift_compile_flags "-Xcc" "-D__SWIFT_CURRENT_DYLIB=swiftCore")
8485
endif()
8586

0 commit comments

Comments
 (0)