Commit Graph

1631 Commits

Author SHA1 Message Date
Yuta Saito
b7c3ceac0f [6.2][wasm] Rename wasm32-unknown-wasi to wasm32-unknown-wasip1 (#83199)
- **Explanation**: Renames the WebAssembly target triple from `wasm32-unknown-wasi` to `wasm32-unknown-wasip1` to align with the broader WebAssembly ecosystem's naming conventions. It's important to include this in 6.2, which is going to be the first stable release of Swift SDK for Wasm, so that we won't introduce a breaking triple change in the stable version series later.

  The WebAssembly ecosystem has been migrating from the generic wasi target name to more explicit version-specific names like `wasip1` and `wasip2`. This change has been adopted across multiple toolchains and language ecosystems:

  - Rust: Renamed `wasm32-wasi` to `wasm32-wasip1` (https://github.com/rust-lang/compiler-team/issues/607)
  - wasi-sdk: Renamed `wasm32-wasi` to `wasm32-wasip1` (https://github.com/WebAssembly/wasi-sdk/pull/386)
  - Go: Already uses `wasip1` naming convention (https://github.com/golang/go/issues/58141)

  The "p1" suffix explicitly indicates WASI Preview 1, which helps distinguish it from the newer WASI Preview 2 (wasip2) and provides clarity about which version of the WASI specification is being targeted.

  Also we already use `wasm32-unknown-wasip1` for Embedded WASI target, and having different names for Embedded and non-Embedded is confusing users.

- **Scope**: Narrow, only affects Wasm Swift SDK.
- **Original PRs**: https://github.com/swiftlang/swift/pull/83167
- **Risk**: Low, just a change to Wasm Swift SDK
- **Testing**: CI.
- **Reviewers**: @MaxDesiatov
2025-07-22 11:23:07 -07:00
finagolfin
d746436d94 Merge pull request #82986 from finagolfin/droid
[6.2][android] Small test and build tweaks
2025-07-18 15:22:47 +05:30
finagolfin
43970ac2f0 [android] Fix an install path and the displayed NDK in the build log (#82620)
I just noticed the install issue when cross-compiling Testing with a
freshly-built compiler, which I'd never done before. Also, fix the NDK
path shown in the CMake output.
2025-07-11 16:21:18 +05:30
Ben Barham
3abc025579 Merge pull request #82018 from al45tair/fix-freestanding-deployment-version
[Build] Fix the minimal-stdlib build by setting a deployment version.
2025-07-08 11:25:17 +01:00
Alastair Houghton
0813e95569 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-07-07 12:04:00 +01:00
Konrad `ktoso` Malawski
c8a8183d26 [6.2][Concurrency][SE-review update] Task names update (#81132)
**Description**: This adds "task name" parameter to all task creating
functions.

This is done in a few ways, e.g. we can backdeploy this to 5.1 in APIs
which do not accept the `TaskExecutor` but it they do we provide a
version for 6.0+ etc. This was requested in the SE acceptable of this
proposal [Acceptance post
SE-0469](https://forums.swift.org/t/accepted-with-modifications-se-0469-task-naming/79438).

This moves all these declarations to gyb since going through them one by
one has become unmaintainable otherwise.

**Scope/Impact**: All task creation APIs now gain a new task name
parameter.
**Risk:** Medium, changes existing APIs rather than adding "even more
overloads" though this risk was discussed in the team and accepted. This
has a potential to be source breaking it someone used Task.init and
friends as function.
**Testing**: CI testing, source compatibility suite testing
**Reviewed by**: 

**Original PR:** 
- https://github.com/swiftlang/swift/pull/81107 build changes required
for this
- https://github.com/swiftlang/swift/pull/80984


**Radar:**

---------

Co-authored-by: Kuba Mracek <mracek@apple.com>
2025-05-29 07:52:33 +09:00
3405691582
44df123056 Unconditionally add -z,origin on OpenBSD. (#80897)
This is a little less than ideal, since as I understand it, it only
makes sense to add -z,origin when $ORIGIN expansion is required, but
doing this surgically per target is rather cumbersome. I don't believe
there are any significant drawbacks to doing it unconditionally like
this, however.
2025-04-30 20:05:35 -04:00
Evan Wilde
30b4aa5a58 SILOptimizer: Disable invalid passes in C++-only compiler
The SimplifyCFG and LoopRotate passes result in verification failures
when built in a compiler that is not built with Swift sources enabled.

 - Scope: Disables optimizers passes in C++-only compiler for
   bootstrapping purposes. Has no impact on full Swift compiler build.
 - Risk: Low. This change has no impact in build environments where a
   Swift compiler is available.
 - Reviewers: @eeckstein
 - Testing: PR testing -- Full PR testing fails if passes are
   accidentally disabled.

Fixes: rdar://146357242

(cherry picked from commit bca1378fdb)
2025-04-23 14:07:35 -07:00
3405691582
fdf70a2b57 Use -z,nobtcfi when BTCFI is disabled on OpenBSD.
This was accidentally left off from #80389, and will properly ensure
BTCFI enforcement is disabled on the platform when required.
2025-04-15 16:07:38 -04:00
Rintaro Ishizaki
90340a069a Merge pull request #79918 from rintaro/cmake-no-emit-module-separately
[CMake] '-no-emit-module-separately-wmo' for swift modules
2025-03-17 11:38:18 -07:00
Rintaro Ishizaki
ca5a020e21 [CMake] '-no-emit-module-separately-wmo' for swift modules
Emitting modules in separate frontend job doesn't give any benefits
because single add_library is just a single job from CMake's point of
view. Clients need to wait for `.dylib`/`.so` being emitted before using
the `.swiftmodule`. *Not* emitting modules separately is actually faster
in CMake because it doesn't parse and typecheck the source code twice.
2025-03-11 13:33:34 -07:00
Rintaro Ishizaki
860ea2c967 [CMake] Fix package CMO capability chekcing logic
Package CMO requires '-enable-library-evolution' in 6.1+ compilers.
Otherwise:
  <unknown>:0: error: Library evolution must be enabled for Package CMO

rdar://146673779
2025-03-10 11:09:47 -07:00
Yuta Saito
9595425717 Merge pull request #79344 from kateinoigakukun/pr-c16855f8d94328f5545bcc3105985cd5286ce69f
[build] Configure library naming conventions for WebAssembly platforms
2025-02-14 13:32:43 +09:00
Yuta Saito
bf008af355 Merge pull request #79343 from kateinoigakukun/pr-fba68e2574f281558869dcf2006c48d8cf894e99
[build] Add initial support for Emscripten SDK
2025-02-14 13:32:20 +09:00
Yuta Saito
720327727f [build] Configure library naming conventions for WebAssembly platforms
Use the same conventions used in wasi-libc and Emscripten
2025-02-13 00:54:13 +00: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
Yuta Saito
6e3d401b41 [build] Stop assuming llvm is always the top-level in unified build
Even with unified build, llvm is not always the top-level project but it
can be a part of a larger build. (e.g. [^1]) In that case,
`CMAKE_BINARY_DIR` is not the binary directory of llvm but the binary
directory of the top-level project. This patch fixes the issue by using
`LLVM_BINARY_DIR` instead.

[^1]: 9b4b907079/extensions/cxx_debugging/CMakeLists.txt (L105)
2025-02-13 00:27:02 +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
Michael Chiu
c6d9efa553 Remove FreeBSD version from SDK triple 2025-02-01 12:05:39 -08:00
Cyndy Ishida
3232df4d67 Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)' (#79018)
* Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)'

    * [BuildSystem] Stop building for i386-watch-simulator

    In Xcode16 it is not supported.

This initially broke client projects who were still building the legacy
architecture but now that's resolved.
2025-01-31 15:04:28 -08: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
Saleem Abdulrasool
78ec9a7af6 Merge pull request #78774 from compnerd/unknown-silence
build: silence C4067 on Windows (NFCI)
2025-01-22 08:26:16 -08:00
Saleem Abdulrasool
6b58947382 build: silence C4067 on Windows (NFCI)
This silences a warning that the MSVC compiler emits about unknown
pragmas. This helps clear up the build a small amount so real issues do
not get hidden.
2025-01-21 09:37:11 -08:00
Saleem Abdulrasool
c9e4dff925 build: only add compiler flag if it is supported
This ensures that we only add the flag if it is supported by the
compiler rather than doing it unconditionally.
2025-01-21 09:35:24 -08: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
Cyndy Ishida
1b869ef828 Revert "[BuildSystem] Stop building for i386-watch-simulator" (#77911)
* Revert "[Build] Fix swift_build_support tests."

This reverts commit fc2d1b3b23.

* Revert "[BuildSystem] Stop building for i386-watch-simulator (#77692)"

This reverts commit 1ab968d2b6.

This change can't be made without other issues fixed downstream first.
2024-12-03 23:17:12 -08:00
3405691582
301a0c49fc Swift on OpenBSD supports arm64.
However, to do this, we end up changing how amd64 is supported too.
Previously, I had tried to keep some meaningful separation between
platform spelling and LLVM spelling, but this is becoming more difficult
to meaningfully maintain.

Target specifications are trivially converted LLVM triples, and the
module files are looked up by LLVM triples. We can make sure that the
targets align, but then the Glibc to SwiftGlibc import breaks. That could
also be addressed, but then we get to a point where the targets set up
by build-script and referenced by cmake begin to misalign. There are
references in build-script-impl for a potential renaming site, but it's
not quite enough.

It's far simpler to give up and rename to LLVM spellings right at the
beginning. This does mean that this commit is less constrained to just
adding the necessary parts to enable arm64, but it should mean less
headaches overall from differing architecture spellings.
2024-11-30 16:33:46 -05:00
Cyndy Ishida
1ab968d2b6 [BuildSystem] Stop building for i386-watch-simulator (#77692)
* [BuildSystem] Stop building for i386-watch-simulator

In Xcode16 it is not supported.
2024-11-20 08:57:19 -08:00
Saleem Abdulrasool
cc27c83fc8 build: adjust the early swift-driver handling
Windows has a strict limit on the file path, and use of extended names
for the build is not possible. Rather than hardcoding the location of
the early swift-driver build, allow the user to specify the path. If the
path is specified, we will attempt to copy `swift-driver` and
`swift-help` from that location. Adjust the code to account for the
build executable suffix. This should allow Windows to experiment with an
early swift-driver build.
2024-11-13 10:14:22 -08:00
Egor Zhdan
5b2fd17d4a [build] Keep building Cxx binary for 32-bit watchOS
This reverts a part of ae3e4a1a.

The Cxx and CxxStdlib binaries should be built for all the targets that Swift can back-deploy to.

rdar://138230091
2024-10-22 16:06:40 +01:00
Rintaro Ishizaki
fdacd9dabb [CMake] Add 'CXX_INTEROP' option to add_pure_swift_host_library 2024-10-02 19:34:59 -07:00
Rintaro Ishizaki
e916e9e459 [CMake] Give a dedicated component to compiler swift-syntax libraries (#76497)
* [CMake] Give a dedicated component to compiler swift-syntax libraries

'compiler-swift-syntax-lib' so projects statically link to compiler
libraries (libAST etc) can use the required shared libraries.

rdar://135923606

* Update cmake caches

* Add back implicit `swift-syntax-lib` to `compiler` component for now

Some clients doesn't specify `swift-syntax-lib`.
2024-09-16 21:34:32 -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
Rintaro Ishizaki
2eade1e3cc Merge pull request #76253 from rintaro/cmake-package-cmo-rdar135110846
[CMake] Enable library evolution unconditionally for package CMO
2024-09-04 13:54:32 -07:00
Rintaro Ishizaki
7a002b29b9 [CMake] Enable library evolution unconditionally for package CMO
'-package-cmo' requires consistent resilient settings among package
modules at this point. Even if a module (e.g. execuables) don't provide
any public interfaces, specify '-enable-library-evolution'

rdar://135110846
2024-09-04 09:25:29 -07:00
Ben Langmuir
ae3e4a1a10 [watchos] Stop building watchos-armv7k and watchsimulator-i386
When the deployment target is above 9.0 (7.0 for simulator), only
building the module content such as the swiftinterface is supported.
2024-09-03 09:32:01 -07:00
Egor Zhdan
ec09fa773f Merge pull request #76124 from swiftlang/egorzhdan/maccatalyst-deployment-target
[build] Do not override macOS deployment target when macCatalyst is enabled
2024-08-30 17:02:35 +01: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
Rintaro Ishizaki
3bf75e7130 [CMake] Typo target -> target_name 2024-08-28 20:55:52 -07:00
Rintaro Ishizaki
371dfe860e [CMake] Build macro plugin and plugin servers as a package
Build 'lib/swift/host' libraries and linking binaries as a single
"package" instead of buillding the linking binaries with
"prefer-interface" hack.
This enables CMO between them.
2024-08-28 15:03:05 -07:00
Egor Zhdan
e1bff808d7 [build] Do not override macOS deployment target when macCatalyst is enabled
Cxx.swiftmodule should built with a macOS deployment target set to 10.9, the minimum possible version. Since we enabled macCatalyst for this target, it inadvertently started being built with a deployment target set to 13.0, which is too new and is causing build errors in certain projects.

This change makes sure that for Swift targets within the Swift project that explicitly specify `DEPLOYMENT_VERSION_OSX`, the macCatalyst build logic doesn't silently discard this flag.

rdar://133008827
2024-08-28 15:37:00 +01:00
Daniel Rodríguez Troitiño
4921eaf92f [CMake] Avoid stomping cache variables when cross-compiling (#76054)
If one is building unified and also cross-compiling (for example
building from Linux x86_64 to Linux aarch64), these variables which are
normally set in the cache pointing to a native toolchain are overwritten
unconditionally pointing to the `CMAKE_BINARY_DIR`, which can be
incompatible with the build machine.

The value of `SWIFT_NATIVE_CLANG_TOOLS_PATH` is eventually passed to the Swift
compiler as `-tools-directory`, which the new `swift-driver` actually
seems to use to find `swiftc`. When the `swift-driver` tries to use the
incompatible `swiftc`, it returns with a very unhelpful "error: failed to
retrieve frontend target info".

Avoiding overwriting the variables when cross-compiling lets the build
system use the variables provided in the cache, which point to correct
binaries for the build machine.
2024-08-23 06:59:41 -07:00
Rintaro Ishizaki
39af14198d [CMake] Enable package CMO only in newer compilers 2024-07-29 17:10:39 -07:00
Rintaro Ishizaki
2c63bf2b48 Merge pull request #75304 from rintaro/swiftsyntax-package-cmo
[SwiftSyntax] Enable Package CMO if possible
2024-07-19 17:34:09 -07:00
Rintaro Ishizaki
f0808e5335 [SwiftSyntax] Workaround a crash
The compiler crashes when compiling swift files importing package-cmo
enabled '.swiftmodule'. Avoid that by not-using '.swiftmodule'.
2024-07-17 14:29:28 -07:00