The condition previously depended on the specific OS, but the image
boundary is the same for all platforms using Wasm as image format. This
fixes the Emscripten build.
When building the standard library statically on Windows, we should not
use any __declspec(dllimport) or __declspec(dllexport) on the runtime
functions or data. Furthermore, we should internalise all of the
standard library functions so that they are not re-exported if used to
build a shared library. The code generation changes required for this
are easier to identify once a static SDK is available for Windows.
Darwin defines memcmp with optional pointers. Update SwiftShims to
define it to the same type to avoid deserialization failures where we
get one over the other and the types don't match anymore.
rdar://140596571
macOS 15.0, iOS 18.0, et al has started unconditionally declaring `lgamma_r` in <math.h>, add a __has_include in SwiftShims to detect that and not redeclare it when building against those SDK versions.
rdar://115192929
PR #74394 removed a field from `struct MetadataSections` whose layout is ABI.
So restore that field as an unused padding field to preserve the layout of all
the other fields in that struct.
without relying on spare bit information in the reflection metadata
(which was added in #40906). As a result, we can remove the
code from #40906.
This is the first step in such removal. It removes the RemoteMirror
code for looking up such metadata. It leaves behind:
* Sufficient stubs for LLDB to continue to build. Once LLDB is updated, these stubs can be removed as well.
* The compiler code to emit such metadata. This allows new binaries to still reflect MPEs on older runtimes. This will need to be kept for a transitional period.
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
This change replaces the use of `__has_feature(swiftasynccc)` with
`__has_extension(swiftcc)` to detect the SwiftCC availability. The former
condition works fine for most platforms that support both SwiftCC and
SwiftAsyncCC or neither, but it fails for WebAssembly, which supports
SwiftCC but not SwiftAsyncCC.
We add `swiftcc` extension to Clang, and use it here.
In several places, there was the same or similar code to either do
a symlink or use copy/copy_if_different/copy_directory in Windows
systems. The checks were also slightly different in some cases.
There is a `SWIFT_COPY_OR_SYMLINK` that can be controlled as a CMake
option, and uses `CMAKE_HOST_UNIX` as default. Change all cases that
I can find to use that value. Also create a parallel value
`SWIFT_COPY_OR_SYMLINK_DIR` to apply to directories.
There is still a couple of cases that are specific to macOS SourceKit
framework which I have left as-is, since symlinks is probably the only
right thing to do there.
There's a case for Windows specifically that uses symlinks (in
523f807694/cmake/modules/SwiftConfigureSDK.cmake (L502))
which I have not modified as well.
Fix overflow detection on unowned refcounts so that we create a side table when incrementing from 126. Implement strong refcount overflow to the side table.
The unowned refcount is never supposed to be 127, because that (sometimes) represents the immortal refcount. We attempt to detect that by checking newValue == Offsets::UnownedRefCountMask, but the mask is shifted so that condition is never true. We managed to hit the side table case when incrementing from 127, because it looks like the immortal case. But that broke when we fixed immortal side table initialization in b41079a8f54ae2d61c68cdda46c74232084af020. With that change, we now create an immortal side table when overflowing the unowned refcount, then try to increment the unowned refcount in that immortal side table, which traps.
rdar://123788910
We would check the SYSTEM_NAME rather than the HOST_SYSTEM_NAME variable
where the former is the host and the latter is the build. The behaviour
is concerning the build and so we would behave incorrectly.
The code to copy the refcounts from the object to a new side table wasn't quite right on 32-bit. Fix it to copy the PureSwiftDealloc field, and if the object is immortal, mark the side table's refcount as immortal too.
rdar://121943608
Don't delete the OS declaration of `exit` because the concurrency shims aren't always imported, and so the shim declaration might not always be available.
Don't override the OS declaration of `exit` in the concurrency shims since we can't just delete the OS one. Instead, set up internal shims just for building Concurrency that forward declares `exit`.