Commit Graph

1122 Commits

Author SHA1 Message Date
(null)
d6811260a9 Merge commit '665515c781999a81094bbe4f8302a7cb1a6a6b39' into mchiu/freebsd 2025-06-17 15:12:23 -04:00
Hamish Knight
8f4fbe3d9a [cmake] Remove remaining XCODE checks
I missed these when ripping out support for CMake Xcode project
generation.
2025-06-09 22:16:12 +01:00
Alastair Houghton
19dba09424 [Build] Disable Concurrency if the deployment version is too low.
For the new runtime build only (and only when triggered from the old
build system), turn Concurrency off if the deployment target is less
than 10.15.
2025-06-04 17:01:00 +01:00
Alastair Houghton
d5ed335339 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-06-03 15:01:22 +01:00
Michael Chiu
7bbafc599d Merge branch 'main' into mchiu/freebsd 2025-06-02 13:33:18 -04:00
Ben Barham
b0d5e0e8f1 Merge pull request #81697 from bnbarham/use-toolchain-version
Add the distribution tag to `-print-target-info`
2025-05-30 09:51:03 -07:00
Ben Barham
3c098782b4 Add the distribution tag to -print-target-info
Ideally this would also update the `--version` output to be overridden
by `SWIFT_TOOLCHAIN_VERSION`, but unfortunately various tools rely on
the current format (eg. swift-build).
2025-05-28 17:29:17 -07:00
michael-yuji
8738e722bd Merge branch 'main' into mchiu/freebsd 2025-05-28 14:44:11 -07:00
michael-yuji
9a948a9c3b Merge branch 'main' into mchiu/freebsd 2025-05-21 16:29:16 -07:00
Eric Miotto
58a782b98b [Runtimes][CMake] use config mode first in Supplemental build in CI
In this configuration we want to pull dependencies from the current
build, not from the underlying SDK.

Addresses rdar://151784135
2025-05-21 12:20:13 -07:00
Alastair Houghton
28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
Justice Adams
2eaa0e93ad [Runtimes][CMake] Supplemental super-build (#81179)
Continue with https://github.com/swiftlang/swift/pull/81006/

Will land the common Cmake modules next before implementing
Synchronization build
2025-04-30 14:23:04 -07:00
Doug Gregor
e49afc8797 Merge pull request #80389 from 3405691582/nobtcfi
Add a build flavor to opt-out of BTCFI on OpenBSD.
2025-04-03 13:29:04 -07:00
3405691582
a341ce5570 Add a build flavor to opt-out of BTCFI on OpenBSD.
To work-around #80059, we need to stop return address signing and
opt-out of BTCFI enforcement via enabling a platform linker option.

We don't want to completely undo the BTCFI work in the rare case that
we later figure out how to properly address the above issue, or allow
users who might want to benefit from BTCFI enforcement and won't use
Concurrency. To do this, condition the existing BTCFI flag enforcement
into a configuration option that defaults to off for now.

Because the new swift-driver needs to "know" whether the frontend is
configured to opt-out or not, and since the new driver communicates with
the frontend via the target info JSON to begin with, we add a field
that emits the build flavor to signal the right behavior.
2025-03-29 10:47:23 -04:00
Evan Wilde
d36b06747a [CMake] StringProcessing: Disable CMake compiler check (#80364)
The CMake compiler checks depend on StringProcessing being implemented.
The old build system may not have rebuilt the module, which will cause
the compiler check to fail. Disable the CMake compiler verification.
2025-03-28 09:05:56 -06:00
Evan Wilde
ecc90933a2 Merge pull request #80328 from etcwilde/ewilde/stdlib-string-processing
[CMake] [Stdlib] Build StringProcessing with new stdlib build
2025-03-27 15:06:47 -07:00
Evan Wilde
7a71441219 [CMake] Enable StringProcessing build
Enable building the regex parser as part of the new runtime build steps.
2025-03-26 17:19:43 -07:00
Max Desiatov
eb1a2960b6 Enable _Concurrency for Embedded Swift with WASI (#79292)
WASI with Embedded Swift provides WASI-libc and libc++ headers necessary to build the `_Concurrency` module for Wasm. We now add `wasm32-unknown-wasip1-wasm` triple to `EMBEDDED_STDLIB_TARGET_TRIPLES` when `SWIFT_WASI_SYSROOT_PATH` is set, which builds the necessary stdlib slice.

---------

Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
2025-03-26 21:14:05 +00:00
Michael Chiu
7f0f2ac4dd Merge swiftlang#38335 2025-03-14 02:15:15 -04:00
Evan Wilde
eeee0dfddd CMake: option to disable swift in swift
Adding `SWIFT_ENABLE_SWIFT_IN_SWIFT` option to enable or disable the
parts of Swift that require a Swift compiler to build. This is meant for
bootstrapping compilers on new platforms and is not guaranteed to result
in a compiler that will pass the test suite.

This option is on by default so that folks won't forget.
If the option is off, the resulting compiler does not include the Swift
optimizer sources in SwiftCompilerSources nor does the resulting
compiler have swift macro support.
2025-03-06 13:32:49 -08:00
Evan Wilde
abc02192f3 Enable Concurrency Build Testing
Enabling building the concurrency runtimes for build-testing purposes.
2025-02-24 16:31:41 -08:00
Yuta Saito
9d4e5b6911 [build] Add initial support for Emscripten SDK
This patch adds initial support for Emscripten SDK alongside the existing
support for WASI SDK. This is a first step towards building a part of
Swift compiler for Emscripten target (which will be used to build LLDB
with Swift to WebAssembly target).
2025-02-13 00:53:45 +00:00
Hamish Knight
d260bd8ddb [build-script] Remove Xcode generation support
This was quite brittle and has now been superseded
by swift-xcodegen. Remove the CMake/build-script
logic for it, leaving the option behind to inform
users to switch to using xcodegen instead.
2025-02-12 12:19:21 +00:00
Rintaro Ishizaki
6f6742f060 Merge pull request #78622 from rintaro/sanitizer-rdar142516855
[CMake] Globally set sanitizer options for Swift targets
2025-01-28 04:56:44 -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
489833d957 CMake: Stdlib: Set deployment target
Pass the minimum deployment target into the builds when appropriate.
Fixes the clang warning about mismatched minimum deployment targets
passed via flag and compiler target.
2025-01-26 08:40:51 -08:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00
Alastair Houghton
18496c5626 [Backtracing] Remove support for implicit import of _Backtracing.
We're going to rename the module to Runtime, and it isn't going to be an
implicit import, so we don't need any of this.

rdar://124913332
2025-01-17 10:09:36 +00:00
Rintaro Ishizaki
84a09071cb [CMake] Globally set sanitizer options Swift targets
For C/CXX targets, sanitizer options are set by 'CMAKE_{C|CXX}_FLAGS' in
HandleLLVMComfig.cmake. However for Swift targets, they are set for each
target. That caused some mismatch issues. Instead set them globally for
Swift targets too.

rdar://142516855
2025-01-13 15:54:39 -08:00
Evan Wilde
e0e418f5d3 Enable new stdlib build in macOS smoke tests
Fixed an issue in the convenience wrapper that resulted in building all
copies of the standard library for the default compiler architecture
instead of the desired architecture. To fix this, we pull the desired
target triple and deployment target from the existing variables and pass
that into the CMake invocation.
2025-01-08 16:23:02 -08:00
Eric Miotto
afdfeefabe [CMake] use same generator for compiler and stdlib builds
This will  support configurations where ninja is not the search path,
and will avoid problems that can arise from the stdlib build detecting
and using a different generator.

Addresses rdar://142268599
2025-01-02 07:51:35 -08:00
Henrik G. Olsson
ef9d2b744d Rename pointer bounds (#78210)
* Make pointer bounds non-experimental

* Rename @PointerBounds to @_SwiftifyImport

* Rename filenames containing PointerBounds

* Add _PointerParam exception to stdlib ABI test

* Add _PointerParam to stdlib API changes

* Rename _PointerParam to _SwiftifyInfo
2024-12-20 11:36:01 +01:00
Hiroshi Yamauchi
d482ab73bc Update the pinned toolchain for Windows and enable SwiftCompilerSources for Win/ARM64 2024-12-13 09:24:44 -08:00
Artem Chikin
338b9141e3 Move libSwiftScan from 'tools' to 'lib/Tooling'
'tools' should be reserved for executable tools.
2024-11-14 08:44:32 -08:00
Henrik G. Olsson
0678829cf7 Add @PointerBounds macro (#76969)
Add @PointerBounds macro

@PointerBounds is a macro intended to be applied by ClangImporter when
importing functions with pointer parameters from C headers. By
leveraging C attributes we can get insight into bounds, esapability, and
(eventually) lifetimes of pointers, allowing us to map them to safe(r)
and more ergonomic types than UnsafePointer.

This initial macro implementation supports CountedBy and Sizedby, but
not yet EndedBy. It can generate function overloads with and without an
explicit count parameter, as well as with UnsafeBufferPointer or Span
(if marked nonescaping), and any of their combinations. It supports
nullable/optional pointers, and both mutable and immutable pointers.
It supports arbitrary count expressions. These are passed to the macro
as a string literal since any parameters referred to in the count
expression will not have been declared yet when parsing the macro.

It does not support indirect pointers or inout parameters. It supports
functions with return values, but returned pointers can not be bounds
checked yet.

Bounds checked pointers must be of type Unsafe[Mutable]Pointer[?]<T>
or Unsafe[Mutable]RawPointer[?]. Count expressions must conform to
the BinaryInteger protocol, and have an initializer with signature
"init(exactly: Int) -> T?" (or be of type Int).

rdar://137628612

---------

Co-authored-by: Doug Gregor <dgregor@apple.com>
2024-11-11 14:54:25 -08:00
Evan Wilde
8385137bfa Auto populate runtime source directory
This patch causes the convenient flow to automatically populate the
sources into the new runtime directory layout. This is run at build-time
so that it repopulates on each build. Since the resync script uses
`COPY_IF_DIFFERENT`, only files that change in the main source directory
are copied over, so incremental builds should still work.

Fixed a small bug in the resync script to ensure that it creates the
subdirectories in the right places.
2024-11-06 21:27:54 -08:00
Evan Wilde
db233bc2f5 Hook new build into existing Swift project
Setting `SWIFT_ENABLE_NEW_RUNTIME_BUILD` to `ON` will build and run the
new standard library build in addition to using the old build. This is
primarily for basic smoke testing at the moment. Once we're confident,
we can start running tests against the stdlib built with the new
build system.

The mechanism will build the stdlib for each of the same platforms that
the old build system would build for, but emitting a separate build
directory with a separate CMake invocation for each configuration.

This will use the just-built compiler if the compiler was not
cross-compiled. If the compiler were cross-compiled, it will use the
compiler from the toolchain that is known to work on the builder.
2024-11-06 21:27:53 -08:00
Rintaro Ishizaki
b14ea191a7 [Windows] Switch to 'PURE' bridging mode for now
With newer llvm, importing 'llvm/include/llvm/ADT/DynamicAPInt.h' causes
an error:

  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\numeric:598:12: error: function '_Select_countr_zero_impl<unsigned long long, (lambda at C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\numeric:598:55)>' with deduced return type cannot be used before it is defined
2024-10-01 15:35:48 -07:00
Rintaro Ishizaki
efe38a0bcf [Windows] Enable "INLINE" bridging mode
* Workaround for https://github.com/swiftlang/llvm-project/issues/7172
* `-D_CRT_USE_BUILTIN_OFFSETOF` to make `offsetof()` a constant
* Pass correct 'swift/shims' search path
2024-09-27 13:50:18 -07:00
Yuta Saito
e044a374e2 Merge pull request #76569 from kateinoigakukun/yt/fix-macos-cross-compile-wasm
[wasm] Fix cross-compilation on macOS host
2024-09-20 10:05:01 +09:00
Yuta Saito
59cda3636a [wasm] Fix cross-compilation on macOS host machine
We didn't set the CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR when
cross-compiling stdlib for WASI. This caused the build to fail on macOS
host machines as the build system was trying to build some overlays
assuming the target is macOS.
Additionally, add a default "SWIFT_HOST_VARIANT_SDK" for WASI target
even though we don't support it as a host system yet because it's
required anyway.
2024-09-18 17:25:13 +00:00
Egor Zhdan
7fad3e7e49 [build] Disable checked iterators on Windows
Trying to run a debug build of the Swift compiler with a host Swift toolchain on Windows was failing with a linker error due to a mismatched `_ITERATOR_DEBUG_LEVEL` macro.

This avoids the linker error by disabling bounds-checked iterators on Windows. See the inline comment for details.
2024-09-18 16:51:01 +01:00
Meghana Gupta
e6fc5c2e6d Delete SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES flag 2024-09-16 14:08:16 -07:00
Ben Langmuir
46a83bea0c Roll back to watchOS 6.0 to keep armv7k support
While the swift compiler in Xcode links against tbd files in the sdk
that contain an armv7k slice, the open source swift toolchain links
against the stdlib dylb that is in the toolchain itself. This means that
we cannot drop support for armv7k support in the stdlib dylib without
losing support for building armv7k when back deploying to older watch
targets. For now, roll back the recent deployment target bump from 9.0
to 6.0 so that we keep armv7k and i386 simulator.

rdar://135560598
2024-09-13 08:49:09 -07:00
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Ben Langmuir
44b68cb5dc Merge pull request #75914 from benlangmuir/turn-it-up-to-11
Bump the deployment target for the compiler to macOS 13.0
2024-09-06 13:23:47 -07:00
Vera Mitchell
b4529a69eb add build-stdlib-docs flag that generates stdlib symbol graphs 2024-09-03 13:52:42 -06:00
Ben Langmuir
ad82d86041 Bump the deployment target for the compiler to macOS 13.0
Bump the deployment target from macOS 10.13-aligned versions to macOS
13.0-aligned versions. This allows us to stop linking CoreFoundation
in the swift runtime, which was previously required for availability
checking. It also lets us align the deployment target on x86_64 with
arm64, which was 11.0. Finally, it is a prerequisite to being able to
build swift using the macOS 15 beta SDKs.
2024-08-29 14:30:09 -07:00