Commit Graph

1344 Commits

Author SHA1 Message Date
Jonas Devlieghere
1cffc7c38f [build-script] Don't use the just-built dsymutil by default
Doing so may have made sense back then, but at this point we should
default to the one in the toolchain. When building with asserts, the
just-built dsymutil will run the DWARF verifier which is slow and not
really desirable in this context.
2025-12-11 10:47:28 -08:00
Evan Wilde
b6b152eabd FreeBSD: Drop system libxml2 dep in tools
This drops the dependency on the system libxml2 from the tools shipped
in the toolchain bundle. libxml2 is disabled entirely for the LLVM/lld
build, which uses it for processing the Windows manifest files. LLDB is
changed to link against the static libxml2 built for the FoundationXML
library. This is technically incorrect since the runtime may be
cross-compiled for a different platform than what the toolchain is built
to run on, but build-script is already mixing toolchain and runtime
content in inconsistent ways, so this is no worse off than we are
already.

libxml2 is updated pretty frequently in inconsistent ways, resulting in
failures to launch due to version incompatibilities.
2025-11-07 09:57:41 -08:00
Jake Petroules
51683c4931 Fix the Swift for macOS installer to encode a minimum OS version for installation (#83273)
Right now it defaults to macOS 10.11, which is of course far below the
intended supported version.
2025-08-25 11:06:32 -07:00
Jake Petroules
b2ad48352c Remove some obsolete properties from the macOS ToolchainInfo.plist (#83274)
- CompatibilityVersionDisplayString isn't required and it's misleading
to write Xcode 8 here, which is far below the actual compatibility
- ENABLE_BITCODE is now ignored by Swift Build
- SWIFT_DISABLE_REQUIRED_ARCLITE is now ignored by Swift Build
- SWIFT_LINK_OBJC_RUNTIME doesn't need to be set as it's already set to
an appropriate per-platform default
2025-08-25 10:52:37 -07:00
finagolfin
e251aea113 [build] Change Foundation macro checks because of #83422 (#83629)
I missed that `build-script` passes back `false` instead, so use the
`true_false` function for broader checking.
2025-08-10 18:29:24 -07:00
Finagolfin
1a0a44b670 [build] Set CMAKE_Swift_COMPILER_TARGET when cross-compiling corelibs 2025-07-10 12:40:24 +05:30
Eric Miotto
1218df3f4e Wire --llvm-include-tests in build-script
This was apparently missing in the migration of the llvm product
from build-script-impl to build-script,
2025-06-16 15:01:52 -07:00
finagolfin
2d735e8c39 [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 21:43:56 +05:30
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
finagolfin
d8243f8328 [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-03 14:57:29 +05:30
Evan Wilde
fd2ba8b95d Fix the ARM architecture on FreeBSD
The 64-bit ARM architecture spelling on FreeBSD is aarch64, not arm64.
This results in a build failure about a missing
`freebsd/arm64/swiftrt.o` while building the runtimes.
2025-05-20 21:38:41 -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
Eric Miotto
7b001765bd Merge pull request #80174 from edymtt/edymtt/use-runtimes-build-quater
build-script: Permit to build compiler-rt with `LLVM_ENABLE_RUNTIMES`
2025-04-22 06:48:17 -07:00
Eric Miotto
0c8171f53c build-script: Permit to build compiler-rt with LLVM_ENABLE_RUNTIMES
LLVM-21 plans to remove the legacy method for building compiler-rt
in the same invocation as LLVM using `LLVM_ENABLED_PROJECTS` and
`LLVM_BUILD_EXTERNAL_COMPILER_RT`.

Support the new way of building compiler-rt with a new build-script
opt-in flag `--llvm-build-compiler-rt-with-use-runtimes` --
this will allow a staged introduction, and will ensure we can revert
back to the old behaviour temporarily in case of unforeseen regression.

Since this flag is meant to be short lived, in an attempt to keep the
logic simple we are gating on it only the
CMake cache entries that strictly control the compilation mode, all the
other entries used for configuring are added in both modes.

Take this chance to remove some stale code from `build-script-impl`, and
move some code in the generic CMake product to the LLVM one.

Addresses rdar://147505298
2025-03-31 13:53:08 -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
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