Commit Graph

1333 Commits

Author SHA1 Message Date
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
finagolfin
6065c13a23 [build] Switch over to new --cross-compile-build-swift-tools flag when cross-compiling Foundation macros (#82163)
Follow-on to #38441, missed this there.
2025-06-11 22:00:05 +05:30
finagolfin
2e5e72baa2 [build] Add a new --cross-compile-build-swift-tools flag to disable cross-compiling the compiler (#38441)
This is useful when building cross-compilation toolchains where you want
the stdlib and corelibs cross-compiled but don't want the Swift compiler
cross-compiled too with `--cross-compile-hosts`.
2025-06-11 21:59:52 +05:30
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
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
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
3405691582
610c351184 Enable PACBTI on OpenBSD/arm64. (#78394)
BTI enforcement is mandatory, which means if PAC and BTI instructions
are not emitted, then the compiled binary gets killed with SIGILL. The
platform default compiler achieves enabling PAC and BTI by embedding the
relevant enabled Clang compilation option flags into the local platform
toolchain, which affects C/C++ code generation.

For Swift however, to achieve the same effect, we would need to add the
relevant LLVM module flags in the IRGen process. But, since Swift uses
the Clang code generator when doing this, using the same option flag
approach will work here as well, and is probably preferable to
introducing operating system-dependent logic to the ClangImporter, for
example.

Finally, the stdlib needs to be built with PACBTI as well, since the
stdlib's global constructors get run when a compiled binary does. Since
the Swift build uses the just-built Clang for the stdlib, just embed the
necessary options into `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS` via
`build-script-impl`. This will be redundant with the host compiler, but
at least it will be thorough.
2025-02-04 07:33:08 +05:30
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
finagolfin
1aded39ea5 [build-script] Disable building and installing the Foundation macros for standalone SDKs (#78782)
Also, remove CMake flag for Android that is now directly set in that repo.
2025-01-30 14:01:58 +05:30
Anthony Latsis
28160c9d09 Merge pull request #78049 from AnthonyLatsis/nelumbo-lutea
build: Unhardcode Swift source directory name
2025-01-09 11:23:17 +00:00
Anthony Latsis
4a5e0daa9d build: Unhardcode Swift source directory name
This is useful if you maintain several swift worktrees that reside in
the source root directory.
2025-01-07 09:58:47 +00: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
Ben Barham
95c30115b9 Merge pull request #77647 from finagolfin/llbuildSwift
[build-script] Stop installing the llbuildSwift library that is no longer used
2024-12-06 12:53:53 -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
Finagolfin
85f38080b1 [build-script] Stop installing the llbuildSwift library that is no longer used 2024-11-15 19:59:17 +05:30
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
Felipe de Azevedo Piovezan
50f1930783 Revert "[build-script] Run LLDB tests with new redecl-completion setting"
This reverts commit 8858585677.

This mode is not working well with rebranch, so we're disabling its testing to
reduce the CI noise.
2024-09-27 08:50:50 -07:00
Adrian Prantl
a341986e75 Remove the LLDB (classic) test configuration. 2024-09-25 10:16:17 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -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
swift-ci
a377cfa315 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-06 13:33:57 -07: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
Felipe de Azevedo Piovezan
ea5ed4888f [build-script] Remove python override
Build script should just use what it is told to use.
2024-08-23 12:27:40 -07:00
swift-ci
7305fcdc57 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-12 09:55:03 -07:00
Jeremy Schonfeld
915f552f0e Fix typo 2024-08-10 10:58:57 -07:00
Jeremy Schonfeld
9d6447d367 Address feedback 2024-08-09 21:54:27 -07:00
Jeremy Schonfeld
8b5a7d86ba Invoke Foundation macros build separately 2024-08-09 16:23:40 -07:00
swift-ci
a665162929 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-17 18:34:07 -07:00
Jeremy Schonfeld
f3acbb079f Remove ICU from the toolchain (#75262)
* Remove ICU from the toolchain

* Remove icu comment from GettingStarted.md
2024-07-17 18:19:16 -07:00
Ben Barham
2715d0e9d6 Merge branch 'main' into 20240710-main-to-rebranch
Conflicts:
  - `test/Interop/Cxx/class/method/methods-this-and-indirect-return-irgen-itanium.swift`
    previously fixed on rebranch, now fixed on main (slightly differently).
2024-07-10 20:42:09 -07:00
Evan Wilde
f446c25e0c Use toolchain clang on macOS
Don't use the just-built clang on macOS. macOS does this more "right"
than the Linux build. Linux will sometimes use the just-built
Swift-driver with the just-built clang, but sometimes would use the
system clang instead. macOS uses the toolchain Swift-driver with the
toolchain clang. This is correct, but it means that if we force the
other clang, we'll get mismatched sanitizer runtimes so the ASAN bot
will fail.
2024-07-09 14:20:07 -07:00
swift-ci
18173c9e9b Merge remote-tracking branch 'origin/main' into rebranch 2024-06-21 15:54:17 -07:00
Jeremy Schonfeld
be6236fce1 Disable CMake-based Foundation tests (#74589)
* Disable old CMake-based Foundation tests

* Remove foundation tests from build-windows-toolchain.bat instead of build.ps1
2024-06-21 15:51:08 -07:00
swift-ci
e3b7f92887 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-03 15:33:42 -07:00
Jeremy Schonfeld
025c976cff Prepare for introducing swift-foundation into the toolchain (#74019) 2024-06-03 15:15:46 -07:00
swift-ci
3ba3913860 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-30 15:35:26 -07:00
Rintaro Ishizaki
faa5003843 [Macros] Add '-plugin-path' the the toolchain's plugins in Info.plist
So Xcode always prefer the plugins in the toolchain to the SDK's. Since
swift.org toolchains include stdlib, it wants to use the plugins in it.
2024-05-30 10:37:29 -07:00
swift-ci
d1957ab6fd Merge remote-tracking branch 'origin/main' into rebranch 2024-05-28 23:34:24 -07:00
swift-ci
a9e8836edb Merge remote-tracking branch 'origin/main' into rebranch 2024-05-28 16:15:22 -07:00
Kuba Mracek
56016a8649 [embedded] Avoid strip-ing .a embedded libraries 2024-05-28 14:03:58 -07:00
Kuba Mracek
1113cffd4b [embedded] Avoid building embedded stdlib when cross-compiling 2024-05-28 14:03:58 -07:00
Kuba Mracek
770d59cc91 [embedded] Avoid building embedded stdlib when cross-compiling 2024-05-28 07:51:17 -07:00
swift-ci
b14e67d820 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-23 22:14:52 -07:00
Evan Wilde
e0f81dadc6 Only set clang linker if it exists
It we're not building clang, the swift driver silently dies and fails to
build. While it shouldn't do that, we should also only tell it to use a
clang that exists. If we're not building clang or the "native" clang
doesn't exist, leave the environment variable unset and let the driver
choose something.
2024-05-23 14:26:34 -07:00
swift-ci
24e9740242 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-20 09:54:08 -07:00
Evan Wilde
b35aecb6d5 Use consistent clang through build
The just-built Swift driver was picking up the system clang, which would
try to use the bfd linker instead of gold or lld. bfd doesn't like how
Swift handles protected symbols and fails with the following error:

```
error: link command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld: /home/build-user/build/buildbot_linux/libdispatch-linux-x86_64/src/swift/CMakeFiles/swiftDispatch.dir/Block.swift.o: relocation R_X86_64_PC32 against protected symbol `$s8Dispatch0A13WorkItemFlagsVSYAAMc' can not be used when making a shared object
/usr/bin/ld: final link failed: bad value
```

This patch tells the Swift-Driver where it should find its clang, and
makes it match the clang that is in use through the rest of the build.
2024-05-15 13:11:06 -07:00
swift-ci
c30af15f40 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-06 23:14:44 -07:00
eeckstein
ade04a7945 Merge pull request #73417 from eeckstein/force-bootstrapping
Force enabling SwiftCompilerSources in the build
2024-05-07 07:55:23 +02:00