Commit Graph

160 Commits

Author SHA1 Message Date
Eric Miotto
332fe6a475 CMake: allow private libraries to be used on older OSes
To do so, use the deployment target versions used for tests.

Addresses rdar://157622116
2025-08-07 15:12:47 -07:00
Ian Anderson
15345ef2d5 [CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code.

rdar://151889154
2025-05-23 23:38:08 -07:00
Eric Miotto
8c7e8550aa CMake: add explicit dependency to _Builtin_float to targets...
... that would import that as a result of importing Darwin from the SDK.

Amend my previous change to Differentiation and Distributed in this
sense.

Addresses rdar://150400049
2025-05-05 10:39:14 -07:00
Alexander Cyon
c21b1e68fd [stdlib] Fix typos 2024-07-06 13:09:57 +02:00
Alex Lorenz
57b89d5303 [android] add an android NDK Swift overlay module, and use it instead of Glibc 2024-05-28 12:57:38 -07: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
Ian Anderson
4dbc58723a [CMake] [Darwin] Don't add the Darwin overlay as a dependency if the overlays aren't being built
Allow for the overlays to not be built in Darwin by respecting SWIFT_BUILD_SDK_OVERLAY.
2023-10-17 11:03:57 -07:00
Yuta Saito
cdd01f9df2 [wasm][cmake] Add WASI specific stdlib dependencies
WASI target has its own libc module WASILibc, so we need to add it as
well as other libc modules.
2023-09-25 18:18:50 +00:00
Max Desiatov
9943f73d0f SwiftPrivate/IO.swift: unify #if canImport checks on non-Windows platforms (#67142)
This simplifies the import statements and adds support for WASILibc.
2023-07-06 10:16:41 +01:00
Max Desiatov
21a2b78801 stdlib/benchmark: add canImport(Musl) where needed (#67120)
This allows compiling stdlib and benchmarks when targeting musl instead of Glibc.
2023-07-05 19:55:08 +01:00
Evan Wilde
f8a54181a9 Zipper all the things!
This patch goes through and adds zippering and the swift module
dependencies to a bunch of pieces of the swift runtimes. Here's to
hoping I hit everything that needed to be hit. :D

With this patch, I'm seeing the appropriate modules under
lib/swift/maccatalyst, so things seem to be working right.
2022-12-22 13:41:59 -08:00
Kuba (Brecka) Mracek
6fe3ccc47d Drop read/write/close LibcShims and use the platform APIs directly from the SwiftPrivate module (#40211) 2022-02-08 15:32:49 -08:00
Saleem Abdulrasool
2fc5cbdc14 stdlib: remove swiftMSVCRT, replace with swiftCRT on Windows
This replaces swiftMSVCRT with swiftCRT.  The big difference here is
that the `visualc` module is no longer imported nor exported.  The
`visualc` module remains in use for a singular test wrt availability,
but this should effectively remove the need for the `visualc` module.

The difference between the MSVCRT and ucrt module was not well
understood by most.  MSVCRT provided ucrt AND visualc, combining pieces
of the old MSVCRT and the newer ucrt.  The ucrt module is what you
really wanted most of the time, however, would need to use MSVCRT for
the convenience aliases for type-generic math and the deprecated math
constants.

Unfortunately, we cannot shadow the `ucrt` module and create a Swift SDK
overlay for ucrt as that seems to result in circular dependencies when
processing the `_Concurrency` module.

Although this makes using the C library easier for most people, it has a
more important subtle change: it cleaves the dependency on visualc.
This means that this enables use of Swift without Visual Studio for the
singular purpose of providing 3 header files.  Additionally, it removes
the need for the installation of 2 of the 4 support files.  This greatly
simplifies the deployment process on Windows.
2020-10-15 16:02:01 -07:00
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Ross Bayer
dfb2d31e74 Rename the LIBRARY_INSTALL_NAME_DIR argument in add_swift_target_library to DARWIN_INSTALL_NAME_DIR which better explains that this argument only controls the install_name_dir for Darwin platforms. 2019-04-29 16:46:09 -07:00
Ross Bayer
b855119fbe Added a new CMake cache variable to control the private standard library install_name_dir. Those libraries are not going to be installed in /usr/lib/swift and thus need to be controlled via a separate mechanism. 2019-04-29 16:46:09 -07:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
Mike Ash
4fb99998ae [Build] Use magic linker symbols to specify an @rpath-relative install name when targeting pre-stable-ABI OSes.
Magic symbols of the form $ld$install_name$os9.0$@rpath/libswiftCore.dylib tell the linker to use that install name when targeting that OS version. Use these symbols to specify an @rpath install name for all back-deployment libraries when targeting watchOS 2.0-5.1, iOS 7.0-12.1, and macOS 10.9-10.14.

rdar://problem/45027809
2019-03-22 10:04:39 -04:00
Michael Gottesman
384882d5f3 Merge pull request #23201 from compnerd/patience-is-not-always-a-virtue
build: introduce and switch to GYB_SOURCES
2019-03-20 13:27:32 -07:00
Saleem Abdulrasool
46bb45a51a SwiftPrivate: add isClosed property
Since the `_FDOutputStream` type does not conform to a protocol, the
required interface was missed.  The changes in
fbce6e7873 introduced a use of the
`isClosed` property which broke the Windows build.  This should fix the
windows build.
2019-03-18 08:05:26 -07:00
Saleem Abdulrasool
8ed5c1a4bc build: introduce and switch to GYB_SOURCES
This avoids us having to pattern match every source file which should
help speed up the CMake generation.  A secondary optimization is
possible with CMake 3.14 which has the ability to remove the last
extension component without having to resort to regular expressions.  It
also helps easily identify the GYB'ed sources.
2019-03-11 13:48:54 -07:00
Saleem Abdulrasool
6827b68a75 SwiftPrivate: correct dependencies on Windows
Ensure that we explicitly state the dependency on WinSDK to avoid issues
in parallel builds.  Caught by the Windows nightlies.
2019-01-06 11:41:18 -08:00
Saleem Abdulrasool
7ecaeb1727 stdlib: implement _FDStreams in terms of HANDLES
Use HANDLE on Windows to create the FDStreams.  This will be used by the
standard library unit test test harness.
2018-12-21 14:19:03 -08:00
Maxim Moiseev
165fe328c3 [stdlib] tee _stdlib_AtomicInt > SwiftPrivate
Turns out some people used this type despite it being prefixed with
`_stdlib_`, so we have to keep it, with an obsoletion message this time.
Second copy of the same type is kept available past Swift 5 in
SwiftPrivate for use in tests.
2018-12-18 16:12:47 -08:00
Saleem Abdulrasool
39f2ac98b7 SwiftPrivate: fix dependencies on Windows
This module needs MSVCRT and WinSDK on Windows.  Track the dependencies.
2018-12-16 22:26:44 -08:00
Mike Ash
9266cb7229 Merge branch 'master' into remove-swiftprivate-swiftdarwin-dependency 2018-11-06 19:45:26 -05:00
Max Moiseev
ddcd8d324a Merge pull request #20243 from arguiot/patch-1
Updated SwiftPrivate.swift using String Interpolation
2018-11-06 14:49:15 -08:00
Mike Ash
45693049bf [Stdlib] Remove SwiftPrivate's dependency on Darwin.
Revert #20194, which seems to be more trouble than it's worth. Instead, move the functions that SwiftPrivate needs back into LibcShims.h/cpp as SPI.

rdar://problem/45817565
2018-11-06 17:41:56 -05:00
Maxim Moiseev
ca51626fd3 [stdlib] Move _stdlib_AtomicInt and friends out of the stdlib 2018-11-06 09:53:58 -08:00
Xiaodi Wu
049b89ce4d Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:19:20 +08:00
Xiaodi Wu
977a9558ce Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:19:12 +08:00
Xiaodi Wu
577e5534fd Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:19:06 +08:00
Xiaodi Wu
f76be9b08f Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:59 +08:00
Xiaodi Wu
dc9d2b5da9 Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:51 +08:00
Xiaodi Wu
3228c800a6 Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:46 +08:00
Xiaodi Wu
aede4b07ab Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:42 +08:00
Arthur Guiot
117d7baab8 Fixed indentation to 2 spaces in SwiftPrivate.swift 2018-11-03 11:27:20 +08:00
Arthur Guiot
e6fea9e6ed Fixed header in SwiftPrivate.swift 2018-11-02 23:46:19 +08:00
Arthur Guiot
b957a3b9d4 Fixed git error... 2018-11-02 23:44:34 +08:00
Arthur Guiot
08f5db8de5 Updated SwiftPrivate.swift using String Interpolation
I updated /stdlib/private/SwiftPrivate/SwiftPrivate.swift using String Interpolations, so the code is more readable and more "Swifty"
2018-11-02 23:32:28 +08:00
Mike Ash
0ce854abf9 [Stdlib] Add Darwin/Glibc as a dependency for SwiftPrivate.
The changes in https://github.com/apple/swift/pull/19614 require Darwin/Glibc to build first. This usually happened anyway (and thus the problem wasn't noticed for a while) but sometimes SwiftPrivate would win the race and the build would fail.

rdar://problem/45624328
2018-10-31 16:46:28 -04:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Mike Ash
5f17b450c3 [Stdlib] Make all the functions in LibcShims.h either INTERNAL or inline. Move LibcShimsInline.h to LibcOverlayShims.h for more consistent naming. Fix up several tests that needed the mock Darwin overlay built. Fix one SourceKit test that no longer produces is_system: 1 on an import Darwin line. 2018-10-03 09:55:34 -04:00
Mike Ash
ec25f928ff [Stdlib] Move _swift_stdlib_read/write/close into LibcShimsInline.h. 2018-10-03 09:55:34 -04:00
Mike Ash
e18e03171f [Stdlib] Change SWIFT_RUNTIME_STDLIB_INTERNAL to not export the symbol.
The functions in LibcShims are used externally, some directly and some through @inlineable functions. These are changed to SWIFT_RUNTIME_STDLIB_SPI to better match their actual usage. Their names are also changed to add "_swift" to the front to match our naming conventions.

Three functions from SwiftObject.mm are changed to SPI and get a _swift prefix.

A few other support functions are also changed to SPI. They already had a prefix and look like they were meant to be SPI anyway. It was just hard to notice any mixup when they were #defined to the same thing.

rdar://problem/35863717
2018-10-03 09:55:33 -04:00
Pavel Yaskevich
6c5e73d177 [stdlib] NFC: Fix deprecation warning related to index(of:)
`index(of:)` has been replaced with `firstIndex(of:)`.
2018-08-31 13:21:12 -07:00
Ben Rimmington
2f326bcc88 [stdlib] Remove theGlobalMT19937
SwiftPrivate/PRNG.swift:

- currently uses `theGlobalMT19937`;
- previously used `arc4random` (see #1939);
- is obsoleted by SE-0202: Random Unification.
2018-08-01 13:00:16 +01:00
Ben Cohen
4694310e51 [stdlib] Some minor cleanup (#18130)
* Remove case destructuring to _

* Remove some Iterator.Element

* Which idiot wrote this? Oh.

* Switch NibbleSort to just use default impls... shouldn't change perf
2018-07-21 17:29:57 -07:00
Michael Ilseman
459833725e [String] Streamline more String creation logic.
Streamline and de-genericize non-inlinable internal functions to
create a String from UTF-8 efficiently.
2018-05-13 07:38:55 -07:00
Michael Ilseman
683fb47c01 Merge pull request #14755 from milseman/so_smol
Smol String
2018-03-28 18:29:50 -07:00