Commit Graph

309 Commits

Author SHA1 Message Date
Evan Wilde
f490e611e1 Merge pull request #79335 from etcwilde/ewilde/catalyst-support
CMake: Catalyst Support
2025-02-19 17:16:09 -08:00
Evan Wilde
ebc0a37760 Set Swift language version to 5
The stdlib needs to build in Swift-5 mode, and ensure that
`-swift-verion 5` be included in the commandline explicitly. While the
compiler defaults to 5 mode, if it's not included explicitly, it won't
be included in the swift interface, which then means that modules that
import it will influence how the textual interface is processed.
The interface for the stdlib must be processed in the Swift 5 language
mode due to sendability. Set it explicitly to ensure that importing
modules do not change the Swift language mode.

Fixes: rdar://145118843
2025-02-19 16:57:43 -08:00
Eric Miotto
b98ca03086 Merge pull request #79464 from edymtt/edymtt/enable-onone-support-on-apple-platforms
Runtimes: enable build of `SwiftOnoneSupport` on Apple platforms.
2025-02-19 13:24:51 -08:00
Saleem Abdulrasool
63b7f05d74 Merge pull request #79443 from compnerd/hermermetic
Runtimes: add `-nostdlibimport` to the runtime build
2025-02-18 20:12:10 -08:00
Evan Wilde
e59326cdd5 CMake: Move installation of binary swiftmodule
To keep things consistent with the target and target-variant swiftmodule
files, moving the installation of the binary swift module into
`install_swift_interface`. CMake implicitly generates the target
swiftmodule, but does not know about zippered binaries, so we need to
ensure that the target-variant module is available for installation when
applicable.
2025-02-18 16:29:37 -08:00
Eric Miotto
3e9a74cc4a Runtimes: enable build of SwiftOnoneSupport on Apple platforms.
Addresses rdar://145066924
2025-02-18 10:30:57 -08:00
Evan Wilde
8f1bc8f3d3 CMake: Apple: Enable catalyst slice
Add the triples to the appropriate Apple build caches, enabling zippered
catalyst builds.
2025-02-18 09:34:17 -08:00
Evan Wilde
35537d449a CMake: Emit catalyst modules
If the driver supports it, emit the swiftmodules and interfaces for the
target-variant slice.
2025-02-18 09:34:17 -08:00
Evan Wilde
aa8138a9d1 CMake: Include zippered catalyst slice
Add the flags to include the zippered catalyst slice if a variant target
triple is set.
2025-02-18 09:34:15 -08:00
Saleem Abdulrasool
53c70df378 Runtimes: add -nostdlibimport to the runtime build
If the compiler being used to build the runtime is from a complete
toolchain, we may inadvertently pick up runtime from the previous build
rather than the just built Swift Core library. Pass `-nostdlibimport` to
ensure that we do not search the default search paths when building and
use the locally built swiftCore.
2025-02-17 15:00:37 -08:00
Evan Wilde
8fe9c094c3 Fix runtime default variable naming
The names of the variables in `DefaultSettings` should end in `_default`
so that the variable that they are defaulting can be overridden.
Otherwise CMake will just set the value and move on overriding the
setting coming from the commandline/cache file.
2025-02-17 10:44:45 -08:00
Saleem Abdulrasool
1458acb451 Merge pull request #78505 from compnerd/concurrent
Runtimes: introduce `swift_Concurrency`
2025-02-15 08:31:19 -08:00
Saleem Abdulrasool
69a3cd8e29 Apply suggestions from code review
Co-authored-by: Evan Wilde <etceterawilde@gmail.com>
2025-02-14 16:19:45 -08:00
Saleem Abdulrasool
34266f630d Runtimes: make resource embedding work on Windows
The `CMAKE_MT` path does not expand as expected. Add a workaround for
the issue so that we are able to build a dynamically linked version of
the standard library with the new runtimes build.
2025-02-14 15:14:55 -08:00
Saleem Abdulrasool
d9b6a8256e Merge pull request #79337 from compnerd/manifesting-destiny
Runtimes: attempt to embed a SxS manifest for swiftCore
2025-02-13 16:36:11 -08:00
Saleem Abdulrasool
1ac0007883 Runtimes: introduce swift_Concurrency
This adds the `swift_Concurrency` module to the new runtimes build. This
is sufficient to build the code but will require further fine tuning to
ensure that all the flags entirely identical and that the ABI surface is
also fully replicated.
2025-02-13 16:24:36 -08:00
Saleem Abdulrasool
a759ead034 Merge pull request #79336 from compnerd/build-number
Runtimes: attempt to wire in the build number into the version
2025-02-13 16:19:17 -08:00
Eric Miotto
f8bba964cf Merge pull request #78726 from edymtt/edymtt/add-ononesupport-to-runtimes
Runtimes: introduce `SwiftOnoneSupport`
2025-02-13 13:53:39 -08:00
Saleem Abdulrasool
509c385458 Runtimes: attempt to embed a SxS manifest for swiftCore
This will allow us to have multiple parallel installations of swiftCore
with the same DLL name allowing us to side-step the ABI instability
without resorting to SOVERSIONing.
2025-02-12 21:59:47 -08:00
Saleem Abdulrasool
6e87083107 Runtimes: attempt to wire in the build number into the version
This is in preparation for using Win32 SxS assembly manifests to permit
co-installation of the runtimes on Windows without an ABI consideration
and allow users to select between the revision.
2025-02-12 14:24:41 -08:00
Guillaume Lessard
c7af9a701b Merge pull request #79294 from Azoy/bye-bye-slab
[stdlib] Rename Slab to InlineArray
2025-02-12 12:03:25 -08:00
Eric Miotto
734c115509 Remove bleeding whitespace from Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2025-02-12 08:54:20 -08:00
Eric Miotto
eb7706ded9 Merge pull request #79266 from edymtt/edymtt/rearrange-core-flags
Runtimes: rearrange flags to match the current stdlib
2025-02-11 13:02:58 -08:00
Alejandro Alonso
e4fb1f6761 Rename Slab to InlineArray 2025-02-11 10:26:44 -08:00
Saleem Abdulrasool
8733205cd5 Merge pull request #79269 from compnerd/closed
Runtimes: use the static module constructor in swiftCore
2025-02-10 14:23:25 -08:00
Saleem Abdulrasool
41b043ecfe Merge pull request #79227 from compnerd/implicit-explicit
Runtimes: remove the explicit linking in the build system
2025-02-10 13:09:55 -08:00
Eric Miotto
66d4665801 Runtimes: hoist more flags from swiftCore to all Core libraries
Addresses rdar://143152066
2025-02-10 13:06:44 -08:00
Eric Miotto
7924cc1a77 Runtimes: use -enable-experimental-concise-pound-file only for Core.
As per #32700, this is only meant for `Swift.swiftinterface`.

Addresses rdar://143152066
2025-02-10 13:06:44 -08:00
Eric Miotto
ba5ccc4516 Runtimes: generate optimization record on Darwin
Addresses rdar://143152066
2025-02-10 13:06:33 -08:00
Saleem Abdulrasool
db4fd6dbee Runtimes: use the static module constructor in swiftCore
Use the static module constructor for swiftCore on Windows as the
runtime functions are internal to the module. This fixes the last linker
warning that we see with the standard library build when building
dynamically. More importantly, this allows building swiftCore as a DLL
with the new build system on Windows as we now treat any linker warnings
as errors.
2025-02-10 09:28:00 -08:00
Saleem Abdulrasool
1098951cea Merge pull request #79231 from compnerd/swifrtT
runtime: add `swiftrtT.obj` build
2025-02-10 09:21:20 -08:00
Eric Miotto
a3fac71446 Merge pull request #79188 from edymtt/edymtt/apply-prespecialize-generic-metadata-to-all-of-core
Runtimes: support generic metadata prespecialization for all of Core
2025-02-10 07:11:26 -08:00
Saleem Abdulrasool
5bb4978b1a runtime: add swiftrtT.obj build
This introduces the new variant of the `swiftrt.obj` - `swiftrtT.obj`
for Windows. This follows the C standard library naming convention as
set forth by GCC.

`crtbegin.o` => used to find constructors
`crtbeginS.o` => used to find constructors in DSOs/PIEs
`crtbeginT.o` => used to find constructors in static executables

The newly minted `swiftrtT.obj` is meant for static linking. The one
exception to this is building the swift runtime itself which locally
defines the symbols and thus should always use the static variant.
2025-02-07 15:29:28 -08:00
Saleem Abdulrasool
c18d6bb7d1 Runtimes: remove the explicit linking in the build system
These libraries are now implicitly explicitly linked. The source files
include `#pragma comment(lib, ...)` to include the autolink directives
to properly handle the dependency propagation to ensure static linking
is sufficiently closed.
2025-02-07 14:14:39 -08:00
Eric Miotto
2a367234be Runtimes: support generic metadata prespecialization for all of Core
Also provide a flag to enabled/disable it.

Addresses rdar://144255917
2025-02-07 07:39:21 -08:00
Saleem Abdulrasool
dca10cf31b Runtimes: adjust the specified version number
Use a full 3-component version specifier as that is required for some
support on Windows. The version number components will be used to
generate the Win32 SxS manifest for embedding within the DLL.
2025-02-06 12:10:29 -08:00
Eric Miotto
c1257eb4ef Runtimes: introduce SwiftOnoneSupport
The main goal for now is to have this building, with little
concern about matching the build flags used currently.

Keep it disabled by default on Apple platforms.

Addresses rdar://143151393
2025-02-03 11:34:51 -08:00
Evan Wilde
e17df88cc1 Merge pull request #78963 from etcwilde/ewilde/stdlib-rebuild-extra-malloc-type
CMake: Define DARWIN_LIBMALLOC
2025-01-28 09:17:31 -08:00
Alastair Houghton
96f23e34b0 [Build] Update SWIFT_TARGET_LIBRARY_NAME for swiftRuntime in new build. (#78977)
We need to change `SWIFT_TARGET_LIBRARY_NAME` for the `swiftRuntime`
target in the new build because of changes made to the old build system.
2025-01-28 09:12:36 -08:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Evan Wilde
3b4dee5cb6 CMake: Define DARWIN_LIBMALLOC
`SWIFT_STDLIB_HAS_MALLOC_TYPE` is defined in terms of
`SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC` in `include/swift/Runtime/Config.h`.
Apple platforms generally have the Darwin libmalloc, so it should be a
safe bet to define it this way. Unfortunately, a lot of things include
the Config.h file, transitively or otherwise, so figuring out exactly
which libraries should have this defined vs ones that should not is
rather tricky, so for now, I've defined it globally.
2025-01-27 15:57:21 -08:00
Saleem Abdulrasool
bf00d8d901 Runtimes: treat linker warnings as errors
We were previously silently emitting incorrect code for the standard
libraries and the warnings were being swallowed by the build system.
This was brought to light by the new build system. The code generation
issues have been addressed. In order to prevent a backslide, we would
ideally use `/WX:4217 /WX:4286`. Unfortunately, `clang-cl` does not
support this, so compromise and use `/WX` which treats all linker
warnings as errors.
2025-01-26 12:56:49 -08:00
Evan Wilde
95f4f6ff80 Merge pull request #78497 from etcwilde/ewilde/stdlib-rebuild-backtrace-reporting
CMake: SwiftCore: Add back SWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING
2025-01-24 21:59:55 -08:00
Evan Wilde
066dc94786 Merge pull request #78860 from etcwilde/ewilde/stdlib-rebuild-platform-arch-dirs
CMake: Add install platform and architecture subdirs
2025-01-24 20:55:47 -08:00
Evan Wilde
5aadacee41 CMake: SwiftCore: Add back SWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING
Add an option to enable emitting a stacktrace on calls to `fatalError`.
This is unrelated to the runtime backtracer for diagnosing normal Swift
crashes.

rdar://142440689
2025-01-23 12:42:28 -08:00
Evan Wilde
f2ddef7601 Merge pull request #78498 from etcwilde/ewilde/stdlib-rebuild-lazy-init-os-trace
CMake: SwiftCore: SWIFT_USE_OS_TRACE_LAZY_INIT
2025-01-23 12:35:18 -08:00
Evan Wilde
a9da4a5c1a CMake: Add install platform and architecture subdirs
In some configurations, libraries are installed under
`<install-prefix>/{libdir}/swift/<platform>/<arch>` and module content
is installed under `<install-prefix>/{libdir}/swift/<platform>`.

This also accounts for the fact that Swift currently looks under
`<install-prefix>/{libdir}/swift_static/**` for the static stdlib
builds.
2025-01-23 12:25:21 -08:00
Saleem Abdulrasool
74a8c588ee Merge pull request #78699 from compnerd/registration-is-closed
Runtimes: adjust installation of swifrt.{o,obj}
2025-01-23 10:06:06 -08:00
Saleem Abdulrasool
17177f8138 Merge pull request #78727 from compnerd/extraction-point
Runtimes: extract platform and arch from the driver
2025-01-23 08:17:26 -08:00
Justice Adams
d1d8cdd170 add SwiftifyImport.swift to source list (#78785) 2025-01-22 13:53:21 -08:00