Commit Graph

17 Commits

Author SHA1 Message Date
Alex Lorenz
978e72cb6e Merge pull request #78161 from swiftlang/hyp/hash-bless-you-and-merry-xmas
[cxx-interop][stdlib] windows - use new hash inline functions like other platforms
2024-12-13 11:00:39 -08:00
Alex Lorenz
9c44e01e07 [cxx-interop][stdlib] windows - use new hash inline functions like other platforms
The PR https://github.com/swiftlang/swift/pull/77857 added windows-specific workaround for https://github.com/swiftlang/swift/issues/77856, that happened after https://github.com/swiftlang/swift/pull/77843. Unfortunately this caused a new issue on windows - https://github.com/swiftlang/swift/issues/78119. It looks like windows is suffering from a similar serialization issue as libstdc++, although its even more complex as the callAsFunction is not only a derived function from a base class, the base class although has a static call operator. In any case, the libstdc++ callAsFunction deserialization fix should align with the static operator () deserialization too, so for now make windows use the same workaround as other platforms to avoid the deserialization crash (77856).

This change was tested on i686 windows too, ensuring that IR verifier crash no longer happens
2024-12-12 23:17:17 -08:00
Kuba Mracek
a02586f1f2 [embedded] Include and use cxxshims in the embedded/ resource dir 2024-12-12 12:12:11 -08:00
Egor Zhdan
c57756168f [cxx-interop] Workaround a deserialization error for CxxStdlib on Linux
In certain versions of libstdc++, `std::hash<std::string>` defines `operator()` in a base class. It looks like Swift is not correctly deserializing an inherited `operator()` for inlinable functions. This change sidesteps the issue by moving the call to `callAsFunction`/`operator()` to the C++ shim layer.

rdar://140358388
2024-11-26 16:27:05 +00:00
Egor Zhdan
0d19a7763c [cxx-interop] Install CxxShim library for macCatalyst
This is a follow-up after the change that enabled Cxx and CxxStdlib overlays on macCatalyst: https://github.com/swiftlang/swift/pull/74994.

The compiler relies on the presence of these shim libraries in the toolchain.

rdar://135275773
2024-09-04 19:09:46 +01:00
Alastair Houghton
0fa5e65bb2 [Stdlib][Build] Fix the standard library build for fully static Linux.
Mostly this just means adding `Musl` as a module dependency of various
things and making sure that we build things for `swift_static` even
if `SWIFT_BUILD_STATIC_STDLIB` isn't enabled.

There's also a slight difference in the declaration of `memcmp()`;
musl's declaration is more like the one we have on Darwin.

rdar://123508245
2024-05-07 16:56:20 +01:00
Egor Zhdan
53fb6531f2 [cxx-interop] Add conversions between std::chrono::duration and Swift.Duration
rdar://123696734
2024-03-01 13:15:05 +00:00
Crazy凡
02a9259dda [cxx-interop] Provide similar support for std::u32string as std::string and std::u16string. 2023-10-10 16:01:15 +08:00
Egor Zhdan
4ce4527ef1 [cxx-interop] Make CxxShim header and modulemap arch-independent
This moves `libcxxshim.modulemap`, `libcxxshim.h` and `libcxxstdlibshim.h` from `*.xctoolchain/usr/lib/swift/macosx/arm64e` to `*.xctoolchain/usr/lib/swift/macosx` to simplify distribution.

rdar://110788977
2023-06-20 15:57:38 +01:00
Egor Zhdan
ce2b116dab [cxx-interop] Enable CxxShim headers for armv7k watchOS
This fixes the `no such module 'CxxStdlibShim'` error when building CxxStdlib for armv7k.

For watchOS, armv7k is included in `${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES}` but not in `${SWIFT_SDK_${sdk}_ARCHITECTURES}`.

rdar://108206099
2023-04-18 18:03:52 +01:00
Egor Zhdan
242a432919 [cxx-interop] Conform std::string to Hashable
rdar://107709149
2023-04-06 16:15:40 +01:00
Egor Zhdan
1d5de34702 [cxx-interop] Move CxxShim header from the SDK to the toolchain
rdar://105799283
2023-02-25 00:23:43 +00:00
Daniel Rodríguez Troitiño
0b05a1ed2d [cxx-interop] Hook libcxxshim modulemap/header to sdk-overlay (#62475)
The modulemap and header files target was added to `ALL`, which works
when invoking the build thru the `build-script`, but make some test fail
when doing a manual configuration and later doing
`check-swift-validation` or similar, because the modulemap/header were
not copied into the build directory.

Follow a pattern similar to the one in GlibC (which this file seemed to
be prepared for, since the `libcxxshim_modulemap_target_list` variable
was already there), create a global target for all the modulemap/headers
of each SDK and add that global target as a dependency of sdk-overlay
(which is a dependency of check-swift-validation and others).
2022-12-09 10:15:18 -08:00
Saleem Abdulrasool
ee996da32d stdlib: enable cxxshim for Windows
This is used by the test suite and needs to be enabled for Windows to
enable parts of the test suite.
2022-10-08 14:19:22 -07:00
Egor Zhdan
b9f9eac7d9 [cxx-interop] NFC: Remove unused source file
`libcxxshim.swift` is not referenced from CMakeLists, and is not needed because libcxxshim is a pure C++ module.
2022-08-22 16:24:08 +01:00
zoecarver
8cf4d3b983 [cxx-interop] Disable cxxshim on windows until we can figure out cmakeconfig. 2022-07-05 20:03:45 -07:00
zoecarver
3805828ad0 [cxx-interop] Add CxxShim library; move __swift_interopStaticCast into it. 2022-07-05 15:52:51 -07:00