Skip to content

Commit

Permalink
Add support for LLVM bitcode sections
Browse files Browse the repository at this point in the history
Add the machinery for, but don't enable, adding LLVM bitcode
sections to Swift standard library and overlay dylibs.

Part of rdar://problem/20730441.

Swift SVN r28329
  • Loading branch information
bitjammer committed May 8, 2015
1 parent f35677d commit 89cef81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ set(SWIFT_INSTALL_COMPONENTS "${_SWIFT_KNOWN_INSTALL_COMPONENTS}" CACHE STRING
set(SWIFT_SDKS "" CACHE STRING
"If non-empty, limits building target binaries only to specified SDKs (despite other SDKs being available)")

set(SWIFT_ALLOW_BITCODE_SECTION "" CACHE STRING
"If non-empty, allows LLVM bitcode binary sections in standard library and overlay binaries for supported platforms.")

set(SWIFT_PRIMARY_VARIANT_SDK "" CACHE STRING
"Primary SDK for target binaries")
set(SWIFT_PRIMARY_VARIANT_ARCH "" CACHE STRING
Expand Down
10 changes: 10 additions & 0 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,16 @@ function(_add_swift_library_single target name)
set(SWIFTLIB_SINGLE_SUBDIR
"${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_LIB_SUBDIR}/${SWIFTLIB_SINGLE_ARCHITECTURE}")

# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
if(SWIFT_ALLOW_BITCODE_SECTION)
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "IOS" OR "${SWIFTLIB_SINGLE_SDK}" STREQUAL "TVOS" OR "${SWIFTLIB_SINGLE_SDK}" STREQUAL "WATCHOS")
set(SWIFTLIB_SINGLE_C_COMPILE_FLAGS "${SWIFTLIB_SINGLE_C_COMPILE_FLAGS}" "-fembed-bitcode")
set(SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS "${SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS}" "-embed-bitcode")
set(SWIFTLIB_SINGLE_LINK_FLAGS "${SWIFTLIB_SINGLE_LINK_FLAGS}" "-Xlinker -bitcode_bundle -Xlinker -bitcode_hide_symbols")
endif()
endif()


if(MSVC_IDE OR XCODE)
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
list(GET split_path -1 dir)
Expand Down

0 comments on commit 89cef81

Please sign in to comment.