Skip to content

[stdlib] Drop ICU #40340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,6 @@ function(_add_target_variant_link_flags)
# link against the custom C++ library
swift_android_cxx_libraries_for_arch(${LFLAGS_ARCH} cxx_link_libraries)
list(APPEND link_libraries ${cxx_link_libraries})

# link against the ICU libraries
list(APPEND link_libraries
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
else()
# If lto is enabled, we need to add the object path flag so that the LTO code
# generator leaves the intermediate object file in a place where it will not
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/SwiftShims/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ set(sources
Target.h
ThreadLocalStorage.h
UnicodeData.h
UnicodeShims.h
Visibility.h
_SwiftConcurrency.h
_SwiftDistributed.h
Expand Down
282 changes: 0 additions & 282 deletions stdlib/public/SwiftShims/UnicodeShims.h

This file was deleted.

1 change: 0 additions & 1 deletion stdlib/public/SwiftShims/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module SwiftShims {
header "System.h"
header "ThreadLocalStorage.h"
header "UnicodeData.h"
header "UnicodeShims.h"
header "Visibility.h"
export *
}
Expand Down
47 changes: 0 additions & 47 deletions stdlib/public/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ set(SWIFTLIB_ESSENTIAL
Hasher.swift
Hashing.swift
HashTable.swift
ICU.swift
Identifiable.swift
Indices.swift
InputStream.swift
Expand Down Expand Up @@ -238,29 +237,6 @@ set(swift_core_link_flags "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
set(swift_core_framework_depends)
set(swift_core_private_link_libraries)
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
list(APPEND swift_core_link_flags "-all_load")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(from outside) Was ICU the only thing using -all_load? Or is this something that can be removed separately? Or is it still needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ICU is the only think that the standard library links against (outside of system libraries like ... libSystem) explicitly. The rest of the dependencies that need to be linked against will be from the clang triggered auto-link. INCORPORATE_OBJECT_LIBRARIES does properly use the TARGET_OBJECTS generator to unpack the archive and link them so no unintentional DCE should occur.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was swiftRuntime.a itself I was worried about, but if that's going through INCORPORATE_OBJECT_LIBRARIES then everything should be okay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that is handled via the incorporate object libraries and so we don't need to worry about the potential DCE.

list(APPEND swift_core_private_link_libraries icucore)
else()
# With the GNU linker the equivalent of -all_load is to tell the linker
# --whole-archive before the archive and --no-whole-archive after (without
# the second, it causes errors when the system libraries are told to
# include everything). The best way to get it in there, according to the
# documentation, is to put the flags in the target_link_libraries setting.

# TODO: However, for the moment this actually makes things explode with an
# incomplete runtime. This should be turned back on when more of the porting
# effort has been completed.
#set(LINK_FLAGS
# -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive)
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
list(APPEND swift_core_private_link_libraries
${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_UC}
${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_I18N})
else()
list(APPEND swift_core_private_link_libraries -licui18nswift -licuucswift -licudataswift)
endif()
endif()

if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL CYGWIN)
# TODO(compnerd) cache this variable to permit re-configuration
Expand Down Expand Up @@ -343,29 +319,6 @@ if(${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTSTRAPPING")
set(b0_deps symlink-headers-bootstrapping0)
set(b1_deps symlink-headers-bootstrapping1)

if(SWIFT_PATH_TO_LIBICU_BUILD)
foreach(bootstrapping "0" "1")
# Need to symlink the libicu libraries to be able to run
# the bootstrapping compiler with a custom library path.
get_bootstrapping_path(output_dir
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" "${bootstrapping}")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
message("TODO: support for copying ICU libraries on Windows")
endif()
set(target "symlink-icu-bootstrapping${bootstrapping}")
add_custom_target(${target})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND
"${CMAKE_COMMAND}" "-E" "make_directory" "${output_dir}"
COMMAND
"ln" "-s" "-f" "${SWIFT_PATH_TO_LIBICU_BUILD}/lib/libicu*" "."
WORKING_DIRECTORY "${output_dir}"
COMMENT "symlink ICU libraries for bootstrapping stage ${bootstrapping}")
endforeach()
set(b0_deps ${b0_deps} symlink-icu-bootstrapping0)
set(b1_deps ${b1_deps} symlink-icu-bootstrapping1)
endif()

list(FIND SWIFT_STDLIB_LIBRARY_BUILD_TYPES "SHARED" index_of_shared)
if(index_of_shared EQUAL -1)
message(FATAL_ERROR "bootstrapping requires SHARED stdlib build type")
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/GroupInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"CString.swift",
"Character.swift",
"CharacterProperties.swift",
"ICU.swift",
"NFC.swift",
"NFD.swift",
"SmallString.swift",
Expand Down
Loading