mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The purpose of this module is to prespecialize generic methods in the stdlib. All symbols exposed by the ABI must be explicitly identified to maintain ABI compatibility. Some of those ABI-exposed symbols reference internal stdlib types. Given that we want the prespecialized code to live in the separate SwiftOnoneSupport library, and we want the module to explicitly list all the symbols required for ABI stability, there's no way around disabling access control when building it. In fact, that flag does precisely what we want. This should be harmless because - no one imports SwiftOnoneSupport.swiftmodule - these internal symbols were always being exposed in SwiftOnoneSupport.dylib, so nothing changes there
33 lines
1.8 KiB
CMake
33 lines
1.8 KiB
CMake
add_swift_target_library(swiftSwiftOnoneSupport ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
|
|
# This file should be listed the first. Module name is inferred from the
|
|
# filename.
|
|
SwiftOnoneSupport.swift
|
|
|
|
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
|
|
|
|
# We have to disable validation of TBD files, because this module is
|
|
# _explicitly_ special-cased to result in extra symbols generated by the
|
|
# optimizer, meaning TBDGen can't (and shouldn't: it has to run
|
|
# pre-optimization for performance) list them.
|
|
SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "-Xfrontend" "-check-onone-completeness" "-Xfrontend" "-disable-access-control" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
|
|
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
|
|
INSTALL_IN_COMPONENT stdlib)
|
|
if(WINDOWS IN_LIST SWIFT_SDKS)
|
|
# When building in Debug mode, the standard library provides the symbols that
|
|
# we need and as such SwiftOnoneSupport does not need to provide any exported
|
|
# interfaces. This results in the import library beinging elided. However,
|
|
# we explicitly link against the SwiftOnoneSupport library when building
|
|
# programs in Debug mode, and need the import library to be generated even if
|
|
# nothing is exported. Because we will still generate the DLL, create an
|
|
# empty import library.
|
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/swiftSwiftOnoneSupport.def
|
|
"LIBRARY swiftSwiftOnoneSupport\n"
|
|
"EXPORTS\n")
|
|
foreach(architecture ${SWIFT_SDK_WINDOWS_ARCHITECTURES})
|
|
target_sources(swiftSwiftOnoneSupport-windows-${architecture} PRIVATE
|
|
${CMAKE_CURRENT_BINARY_DIR}/swiftSwiftOnoneSupport.def)
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/swiftSwiftOnoneSupport.def
|
|
PROPERTIES HEADER_FILE_ONLY TRUE)
|
|
endforeach()
|
|
endif()
|