Commit Graph

848 Commits

Author SHA1 Message Date
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
Alastair Houghton
fc2d1b3b23 [Build] Fix swift_build_support tests.
This was broken by #77692.

rdar://140313372
2024-11-27 09:52:52 +00:00
Yuta Saito
db33b2bd98 Merge pull request #77747 from kateinoigakukun/yt/enable-libcxx-filesystem 2024-11-21 23:59:13 +09:00
Yuta Saito
afea9c53c2 wasm: Enable filesystem APIs in libcxx
As of a recent fix included in LLVM 17[1] and wasi-libc fix[2], we can
enable `LIBCXX_ENABLE_FILESYSTEM` in libcxx build for WebAssembly/WASI.
This allows us to use `<filesystem>`, `<fstream>`, etc in C++ code.

[1]: 66a562d22e
[2]: https://github.com/WebAssembly/wasi-libc/pull/463
2024-11-20 20:59:30 +00: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
Meghana Gupta
5b5acc64e0 Promote Nonescapable types to a language feature 2024-11-18 18:09:17 -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
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
Dave Lee
b8db9d481e [build-script][embedded] Conditionally force compiler-rt baremetal builtins (#77395)
This change allows build-script to be invoked with the following combination:

```
--llvm-targets-to-build=host --build-embedded-stdlib=false
```

When `--build-embedded-stdlib=false` is used, it's unnecessary to force-configure
additional compiler-rt targets. Further, when `--llvm-targets-to-build` is used,
the resulting llvm usually won't support the forced targets of armv6/armv7.
2024-11-05 15:30:32 -08:00
Max Desiatov
91065437aa Flush build step log messages in build_script_invocation.py (#77324)
This ensures that log messages are printed as soon as a corresponding build step starts, instead of printing these messages in the end out of order.

For example, before for SwiftPM

```
--- Cleaning swiftpm ---
--- Building swiftpm ---
--- Running tests for swiftpm ---
--- Finished tests for swiftpm ---
--- Installing swiftpm ---
```

was printed at the end of the CI job log with no actual build phase output in between these markers. Now these build phase markers are printed in the correct order and one can infer which log messages were printed for each build phase.
2024-11-01 12:19:34 -07:00
Yuta Saito
fc2c3c96f4 Merge pull request #77020 from kateinoigakukun/yt/compiler-rt-profile-rebranch
[wasm][build] Enable building compiler-rt/lib/profile
2024-11-01 00:31:37 +09:00
Yuta Saito
375fc598da [wasm] Enable building compiler-rt/lib/profile
This patch enables building `compiler-rt/lib/profile` for WebAssembly
targets. This is necessary to support `-fprofile-instr-generate` for
WebAssembly targets.
2024-10-29 11:34:08 +00:00
Ben Barham
f74b40e37c Revert "build-script: Build core foundation tests without debug info to workaround a linker crash" 2024-10-29 09:25:49 +10:00
Erik Eckstein
ed4fab8445 build-script: Build core foundation tests without debug info to workaround a linker crash
On amazon-linux2 the gold linker (version 1.14) crashes when linking debug info.
rdar://138562663
2024-10-24 21:49:25 +02:00
Erik Eckstein
839d7ae2ef build-script: Build foundation tests without debug info to workaround a linker crash
On amazon-linux2 the gold linker (version 1.14) crashes when linking debug info.
rdar://137760869
2024-10-22 08:40:18 +02:00
Mishal Shah
05ad720f57 Revert "Drop references to clang-pseudo-gen after removal" 2024-10-18 20:58:41 -07:00
Stefan Gränitz
51f41842fe Drop references to clang-pseudo-gen after removal
pseudo was removed from clang-tools-extra in upstream PR https://github.com/llvm/llvm-project/pull/109154
Drop two explicit references in swift and unblock Windows CI
2024-10-17 14:43:18 +02:00
Yuta Saito
d1a26d091d [wasm][build] Disable LLVM unwinder in libcxxabi (#77018)
This change disables the use of llvm libunwind in libcxxabi, which is enabled by default in the rebranched scheme. (https://reviews.llvm.org/D150897) But the llvm libunwind is not supported in the WebAssembly target, so we need to disable it explicitly.

This is a preparation for the upcoming `rebranch` merge.
2024-10-15 16:37:47 +01:00
Alex Hoppen
9c992a7c38 Merge pull request #76730 from ahoppen/ahoppen/lsp-cross-compile
[build] Build sourcekit-lsp for multiple arches and lipo them
2024-10-11 15:14:11 -07:00
Alex Hoppen
04e78e0578 [build] Build sourcekit-lsp for multiple arches and lipo them
Instead of building SourceKit-LSP using SwiftPM's multi-arch xcbuild backend, build it for only one arch at a time and then run `lipo` to merge the two resulting binaries.

This should allow us to share build products between building installing and testing and also eliminates other quirks resulting from the xcbuild backend.
2024-09-26 21:52:49 -07:00
Yuta Saito
24bd384f84 [wasm] Configure LLVM for WebAssembly target independently from the native LLVM build
We have been using the host LLVM build directory to configure the Wasm
Swift stdlib. This has been working fine so far as the stdlib build is
configured with `CMAKE_SYSTEM_NAME` having host system name. However,
we fixed the stdlib build to use `WASI` as the system name properly in
the previous commit. This exposed the issue that the host LLVM build
directory is not suitable for configuring the stdlib build.
2024-09-19 09:11:30 +00: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
Meghana Gupta
e6fc5c2e6d Delete SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES flag 2024-09-16 14:08:16 -07:00
Yuta Saito
37927fd707 wasm: Build static SDK overlay explicitly
The static SDK overlay has been built implicitly for a long time, but
this is not the case anymore after 5bf2c937ab.
We need to build it explicitly now.
2024-09-16 06:15:08 +00:00
Evan Wilde
5271bc2335 Relax Swift tool check to find swiftc
The Swift-Driver build here only requires a working swiftc, not
necessarily all of SPM. Relaxing the required tool check to accept
building the driver if there's a Swift compiler available.
2024-09-10 14:58:07 -07:00
Yuta Saito
5eb3062213 Merge pull request #76147 from kateinoigakukun/yt/swift-testing-wasm
Include swift-testing in the Wasm Swift SDK
2024-09-08 23:24:59 +09: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
736faacbde Merge pull request #76179 from rintaro/cmake-clean-testing-rdar135021207
[build-script] Always clean 'SwiftTesting' and 'SwiftTestingMacros'
2024-09-04 09:42:53 -07:00
Vera Mitchell
c9cc58cd0b update build-script python tests 2024-09-03 13:52:43 -06:00
Vera Mitchell
2dc3995d56 add preview-stdlib-docs command to spin up DocC's preview server 2024-09-03 13:52:42 -06:00
Vera Mitchell
b83c91a2e8 build stdlib docs with docc 2024-09-03 13:52:42 -06:00
Vera Mitchell
b4529a69eb add build-stdlib-docs flag that generates stdlib symbol graphs 2024-09-03 13:52:42 -06:00
Vera Mitchell
b66bc17da2 install DocC-Render in install-all mode when DocC is being built 2024-09-03 13:52:42 -06:00
Allan Shortlidge
48f236d09a build-script: Copy libclang_rt.a from the host toolchain for visionOS.
During the toolchain build, when building the Swift standard library for
platforms other than macOS the `libclang_rt.a` needs to be copied out of the
host SDK. That wasn't happening for visionOS.

Resolves rdar://135023111.
2024-08-30 18:15:13 -07:00
Rintaro Ishizaki
89e9622402 [build-script] Always clean 'SwiftTesting' and 'SwiftTestingMacros'
These products are built with CMake. In incremental build environments,
these products don't detect compiler changes, so the artifacts aren't
rebuilt unless the source code of these projects are changed.
To workaround that, always clean them in build-script to ensure they are
rebuilt.

rdar://135021207
2024-08-30 11:30:47 -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
Yuta Saito
32bfb7e603 Include swift-testing in the Wasm Swift SDK
This change adds build support for swift-testing in the Wasm Swift SDK.
Unfortunately, we can't use the regular SwiftTesting build-script product
because Wasm build cannot use build-script's cross-compilation infrastructure
for now. So we build swift-testing in WasmSwiftSDK product and install it
to the SDK package.
2024-08-29 14:02:38 +00:00
Rintaro Ishizaki
20f201d3ec [build-script] Fix product dependencies
SwiftPM now depends on `SwiftTesting`, `SwiftTesting` depends on
`SwiftTestingMacros`

rdar://133946466
2024-08-19 10:09:40 -07:00
Rintaro Ishizaki
eca7779d00 Revert "[build-script] Fix product dependencies" 2024-08-17 06:23:43 -07:00
Rintaro Ishizaki
852aa7798f [build-script] Fix product dependencies
SwiftPM now depends on `SwiftTesting`, `SwiftTesting` depends on
`SwiftTestingMacros`

rdar://133946466
2024-08-15 11:26:45 -07:00
Saleem Abdulrasool
482b004a69 Merge pull request #75717 from compnerd/curl 2024-08-13 07:32:26 -07:00
Rintaro Ishizaki
e98c5eab61 [build-script] Separate SwiftTestinMacros from SwiftTesting product
Also, build them for all hosts including cross compiling host.
2024-08-09 14:43:20 -07:00
Rintaro Ishizaki
e06d38b3ac [swift-testing] Build tweak
* Remove SwiftSyntax product dependency
* Correct CMAKE_BUILD_TYPE
2024-08-08 13:13:45 -07:00
Stuart Montgomery
155e4c857b Fix header comment 2024-08-08 13:13:44 -07:00
Stuart Montgomery
97e85a6bf2 Build script changes to begin building and installing swift-testing into toolchains (on Darwin, so far) 2024-08-08 13:13:44 -07:00
Saleem Abdulrasool
78c957edc6 utils: update curl to 8.9.1 from 8.5.0
Update the embedded curl version for Windows. Adjust the flags
accordingly.
2024-08-06 11:08:08 -07:00
Jeremy Schonfeld
f89db53698 Ensure Foundation tests don't run when passing --skip-foundation-tests (#75573) 2024-07-31 12:54:48 -07:00
Kuba Mracek
69964f9f22 [embedded] Don't build embedded stdlibs in 'standalone' builds 2024-07-30 10:42:55 -07:00
Jeremy Schonfeld
443c29d3a0 Invoke foundation tests via SwiftPM (#74594)
* Invoke foundation tests via SwiftPM

* Remove CTEST_OUTPUT_ON_FAILURE from Foundation build
2024-07-29 16:38:06 -07:00
Kuba (Brecka) Mracek
6c0fe7c624 Merge pull request #75375 from kubamracek/embedded-macho-builtins2
[embedded] Ask LLVM to build armv6 armv6m armv7 armv7m armv7em Mach-O builtins
2024-07-23 16:47:54 -07:00