Commit Graph

1741 Commits

Author SHA1 Message Date
Artem Chikin
5545581520 Merge pull request #73893 from artemcm/DebugBuildEarlySwiftDriverCopy
Copy over EarlySwiftDriver executables on Debug builds by specifying the correct driver build directory
2024-05-28 10:50:27 -07:00
artemcm
da33e042e4 Copy over EarlySwiftDriver executables on Debug builds by specifyin the correct driver build directory 2024-05-24 11:42:14 -07:00
Egor Zhdan
1d5481655f Merge pull request #73619 from apple/egorzhdan/bootstrapping-without-backdeployment
[build] Fix bootstrapping builds that disable back-deployment
2024-05-22 15:23:50 +01:00
Egor Zhdan
421ee98fc5 [build] Fix bootstrapping builds that disable back-deployment
This fixes a build that passes `-D SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT=NO` and `-D BOOTSTRAPPING_MODE=BOOTSTRAPPING-WITH-HOSTLIBS`.

Previously a few CMake errors would be emitted:
```
CMake Error at cmake/modules/AddSwift.cmake:478 (get_property):
  get_property could not find TARGET HostCompatibilityLibs.  Perhaps it has
  not yet been created.

CMake Error at cmake/modules/AddSwift.cmake:527 (add_dependencies):
  add_dependencies called with incorrect number of arguments
Call Stack (most recent call first):
  cmake/modules/AddSwift.cmake:969 (_add_swift_runtime_link_flags)
  tools/driver/CMakeLists.txt:23 (add_swift_host_tool)
```
2024-05-20 14:31:12 +01:00
Daniel Rodríguez Troitiño
face056ec3 [CMake] Respect LLVM instrumentation variables in libraries and executables (#73629)
In apple/swift#71135 I added this code to `add_pure_swift_host_library`
but failed to realize that it was also needed in
`add_pure_swift_host_tool`. Extract the code into a helper function and
invoke it from both functions in order to be able to instrument the
`swift-plugin-server` and other pure Swift tools.
2024-05-15 15:02:39 -07:00
Alex Lorenz
5905dc9ef3 more cross-arch build.ps1 android fixes 2024-05-14 12:15:06 -07:00
Eric Miotto
ce0e620d1a [CMake] allow custom options when building the compiler with debug info
Currently those are hardcoded to `-g`, but in some Apple internal
configurations we would like to change them.

There are other part of the build system that hardcode `-g`
(e.g. in `SwiftCompilerSources` and `AddSwiftStdlib.cmake`),
but we are not interested in those at the moment -- we will address those
in the future if need be.

Supports rdar://127503136
2024-05-14 08:42:35 -07:00
Alastair Houghton
9e2c13bd10 Merge pull request #71839 from al45tair/eng/PR-123503470
[Build] Add the new fully-static Linux SDK.
2024-05-06 17:34:22 +01:00
Alastair Houghton
6afdcd311f Merge pull request #72061 from al45tair/eng/PR-123504095
[Linux][Runtime][IRGen] Mark metadata sections as retained and support section GC.
2024-05-04 09:23:06 +01:00
Hamish Knight
85d42d1f3b Merge pull request #73383 from hamishknight/fix-stdlibless-build
[cmake] Only check HostCompatibilityLibs for bootstrapping builds
2024-05-03 23:29:44 +01:00
Alastair Houghton
ae1c0455f3 [Build] Add the new fully-static Linux SDK.
Declare a new `LINUX_STATIC` SDK and configure it.

Add options to set the build architectures for the `LINUX` and
`LINUX_STATIC` SDKs, similar to what we have for Darwin, because
we'll be cross-compiling.

Also add an option to point the build system at the sources for
the musl C library, which we're using for `LINUX_STATIC`.

rdar://123503470
2024-05-02 14:56:18 +01:00
Alastair Houghton
8f5980666d Merge pull request #71838 from al45tair/eng/PR-123503191
[Build] Tweak Libdispatch.cmake for static linking support.
2024-05-02 14:54:23 +01:00
Hamish Knight
37dc7ce5b5 [cmake] Only check HostCompatibilityLibs for bootstrapping builds
Locally I build debug builds without the standard library,
using a copy of the stdlib in my release build. This hit
a CMake error here since the `HostCompatibilityLibs` target
isn't defined. Update to only access it when doing a bootstrapping
build.
2024-05-01 22:43:29 +01:00
Eric Miotto
dbc8c4b08b Merge pull request #73065 from edymtt/edymtt/use-hostcompatibilitylibs-for-all-bootstrapping-modes
CMake: ensure Swift host tools depend on HostCompatibilityLibs target
2024-04-30 09:16:31 -07:00
Eric Miotto
4d14497016 CMake: ensure Swift host tools depend on HostCompatibilityLibs target
At the time I implemented #60728, I did not realize that in all the
bootstrapping mode we need to depend on the compatibility libraries we
build -- otherwise when targeting a low deployment target we risk
failing because we are not able to find such libraries.

Addresses rdar://126552386
2024-04-29 10:52:21 -07:00
Alastair Houghton
a014bd2cc8 [Build] Detect ld.gold version and prefer lld if gold is too old.
If we're on a system that has ld.gold 2.35 or earlier, we want to use
lld instead because otherwise we end up with duplicate sections in the
output.

rdar://123504095
2024-04-29 10:48:23 +01:00
Eric Miotto
291065d3b1 CMake: amend search path for Swift content from Darwin toolchain
Additional testing showed that the path I initially choose does not work
in all scenarios.

Expands on #73255
Still addresses rdar://127014753
2024-04-26 15:12:24 -07:00
Eric Miotto
5f545b43f9 CMake: add option to link Swift content from Darwin toolchain
This is needed in specific Apple internal configurations -- as a result
of the limited applicability, this option is not exposed through
`build-script` on purpose.

Addresses rdar://127014753
2024-04-25 12:48:50 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Harlan Haskins
1b36983b8b Add armv4t for GBA programming (#73005) 2024-04-13 18:11:16 -06:00
Saleem Abdulrasool
758fc4f604 Merge pull request #72993 from z2oh/z2oh/set-LLDB_ENABLE_LIBXML2-NO-in-x86_64-cache 2024-04-14 02:23:49 +09:00
Rintaro Ishizaki
a16ad9c274 Merge pull request #71173 from rintaro/cmake-parservalidatoin
[CMake] Add option to perform SwiftParser validation by default
2024-04-12 15:03:31 -07:00
Jeremy Day
1b61c68ab1 Set LLDB_ENABLE_LIBXML2 NO in Windows-x86_64 CMake cache 2024-04-11 15:45:21 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Ben Barham
0d764d059f [Build] Disable -Wdocumentation
LLVM doesn't have this warning enabled, so we end up with a whole tonne
of warnings from the LLVM headers.
2024-04-01 14:27:48 -07:00
Yuta Saito
ca5e7a6bdd build: Rename wasi-threads to wasip1-threads
The WASI community is transitioning to a new naming for the "preview"
version in the target triple: wasm32-wasi -> wasm32-wasip1.
At this moment, we keep the old triple wasm32-wasi because it's already
widely used, but we should start using the new triple threaded target.

LLVM checks only if the OS field *starts* with "wasi", so "wasip1" is
still considered a valid `isOSWASI()` target.

See: https://github.com/WebAssembly/wasi-libc/pull/478
2024-03-29 15:35:14 +00:00
Michael Gottesman
a114a30493 [unittests] Enable debug info when compiling unittests when debug info is enabled.
I noticed this while I was debugging a failure in unittest.
2024-03-26 15:43:22 -07:00
Mike Ash
0491192337 [Runtime] Remove ExternalGenericMetadataBuilder. 2024-03-21 17:56:17 -04:00
Eric Miotto
5aaaae5177 [CMake] Ensure module tracing is off during configuration
Such module usages are not relevant for the final build, they are used
only to detect the capabilities of the compiler.

This generalizes #68453, and would be needed for Apple internal
configurations that set `SWIFT_LOADED_MODULE_TRACE_FILE` when building
the compiler.

Addresses rdar://124954349
2024-03-18 14:56:20 -07:00
eeckstein
9504de5ed7 Merge pull request #71552 from finagolfin/cross-compile
[CMake] Add broader support for cross-compiling the portions of the compiler that are written in Swift to non-Darwin Unix
2024-03-15 16:28:38 +01:00
Saleem Abdulrasool
55812e7b34 Merge pull request #72302 from compnerd/arm64-windows
caches: adjust the Windows cache files for runtimes
2024-03-13 19:52:12 -07:00
Saleem Abdulrasool
673c3929f1 caches: adjust the Windows cache files for runtimes
Add the Windows ARM64 builtins and profile libraries for the toolchain.
2024-03-13 11:43:22 -07:00
Allan Shortlidge
347a1409ba CMake: Pass -no_warn_duplicate_libraries to the linker when supported.
The output of build-script on macOS is currently full of spammy linker warnings
like this:

```
ld: warning: ignoring duplicate libraries: '.../swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/lib/libLLVMDemangle.a', 'lib/libswiftDemangling.a'
```

Apple's linker complains about duplicate libraries, which CMake likes to do to
support ELF platforms. To silence that warning, we can use
`-no_warn_duplicate_libraries`, but only in versions of the linker that support
that flag.
2024-03-12 22:25:05 -07:00
Daniel Rodríguez Troitiño
42e43edef3 [cmake] Unify usage of create_symlink/copy across the build files. (#72202)
In several places, there was the same or similar code to either do
a symlink or use copy/copy_if_different/copy_directory in Windows
systems. The checks were also slightly different in some cases.

There is a `SWIFT_COPY_OR_SYMLINK` that can be controlled as a CMake
option, and uses `CMAKE_HOST_UNIX` as default. Change all cases that
I can find to use that value. Also create a parallel value
`SWIFT_COPY_OR_SYMLINK_DIR` to apply to directories.

There is still a couple of cases that are specific to macOS SourceKit
framework which I have left as-is, since symlinks is probably the only
right thing to do there.

There's a case for Windows specifically that uses symlinks (in
523f807694/cmake/modules/SwiftConfigureSDK.cmake (L502))
which I have not modified as well.
2024-03-09 18:03:55 -08:00
Yuta Saito
82740fe969 wasm: Add support for WASI threads in CMake build system
This patch adds a new CMake option, `SWIFT_ENABLE_WASI_THREADS`, to
enable building the Standard Library using WASI threads primitives
(https://github.com/WebAssembly/wasi-threads). With this option, the
Standard Library will be built for the new "wasm32-unknown-wasi-threads"
target. We add the new triple because the WASI threads proposal requires
extra syscalls and object files compiled to "wasm32-unknown-wasi" and
"wasm32-unknown-wasi-threads" are not compatible and cannot be linked
together.
2024-02-29 14:44:10 +00:00
Alastair Houghton
82bd345f64 [Build] Tweak Libdispatch.cmake for static linking support.
Don't try to build dynamic libraries if the SDK only supports
static linking.  Also, *do* build static libraries if the SDK
only supports static linking.

rdar://123503191
2024-02-23 15:49:52 +00:00
Alastair Houghton
4bfa31afb7 [Build] Add support for static-linking to the SDK system.
Add some additional SDK variables that let us mark an SDK as
supporting static linking, and/or supporting *only* static
linking.

rdar://123503009
2024-02-23 15:48:57 +00:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Finagolfin
fcf7614638 [CMake] Add broader support for cross-compiling the portions of the compiler that are written in Swift to non-Darwin Unix
Add cross-compilation flags for the newly added Swift source in `lib/ASTGen/`,
similar to how `SwiftCompilerSources/` is already cross-compiled for other
platforms. Make sure the Swift source in the compiler builds and links against
`SWIFTLIB_DIR` in this cross-compilation build directory, not the one that comes
with the native host compiler.

This requires changing the dependency chain in `CROSSCOMPILE` mode, as normally
the Swift compiler is built first when building natively for the host, then it's
used to build the stdlib. However, when cross-compiling the toolchain, the stdlib
must be cross-compiled first by the host compiler, then the portions of the
Swift compiler written in Swift must be cross-compiled with that new stdlib. All
these dependency changes simply change that compilation order when cross-compiling,
including removing the dependency that the Swift compiler is built before the
stdlib when cross-compiling the Swift compiler.

All changes in this pull are gated on the `CROSSCOMPILE` mode, so they will
not affect any of the existing CI or build presets.
2024-02-13 12:24:24 +05:30
Guillaume Lessard
114f235d17 Merge pull request #71167 from vanvoorden/vanvoorden/inclusive-language
[Inclusive Language][Comments][Documentation] migrate "sanity" checks to "soundness" checks
2024-02-02 10:27:34 -08:00
Daniel Rodríguez Troitiño
cc25000e1d [CMake] Respect LLVM instrumentation variables in AddPureSwift.cmake (#71135)
If one is building Swift against an instrumented LLVM build, when the
functions in AddPureSwift.cmake tries to link Swift code that also links
LLVM instrumented code, the linking will fail because the linker will
not use the profiling runtimes.

The modifications replicate the existing code in LLVM
HandleLLVMOptions.cmake, but adapted to Swift variables where possible.

The necessary arguments are forwarded through `-Xclang-linker` because
the spelling of the Swift driver does not give access to all the options
that Clang provides.

This has been tested with an unified build, but a standalone build could
still pass the `LLVM_*` variables to the Swift build system to make use
of this code.
2024-01-31 08:47:29 -08:00
Saleem Abdulrasool
0dc8fbdb96 Merge pull request #70814 from compnerd/format
build: migrate to CMake based build of swift-format
2024-01-28 11:29:30 -08:00
Saleem Abdulrasool
1864caad5e build: migrate to CMake based build of swift-format
This allows us to build swift-format with dynamic linking against the
toolchain build of the swift-syntax and swift-argument-parser packages.
Wire up the swift-markdown build and hoist the swift-format build prior
to sourcekit-lsp. This sets us up for supporting swift-format based
formatting in the LSP.
2024-01-26 15:51:29 -08:00
Mike Ash
4bc7726d43 Merge pull request #70900 from mikeash/swift-generic-metadata-builder-out-of-process
[Tools] Add a library to build specialized generic metadata out of process.
2024-01-26 10:50:34 -05:00
Rintaro Ishizaki
810a94cd0f [CMake] Add option to perform SwiftParser validation by default
Disabled by default. We'll enable it for some build presets.

rdar://121545713
2024-01-25 22:32:22 -08:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Mike Ash
4341102c92 [Tools] Add a library to build specialized generic metadata out of process.
This library uses GenericMetadataBuilder with a ReaderWriter that can read data and resolve pointers from MachO files, and emit a JSON representation of a dylib containing the built metadata.

We use LLVM's binary file readers to parse the MachO files and resolve fixups so we can follow pointers. This code is somewhat MachO specific, but could be generalized to other formats that LLVM supports.

rdar://116592577
2024-01-24 20:45:50 -05:00
Saleem Abdulrasool
0d3f6a9f06 Merge pull request #70791 from compnerd/cmark
build: update for cmark build revamp and split the build
2024-01-24 14:40:23 -08:00
Adrian Prantl
393e48c756 Merge pull request #71023 from adrian-prantl/swift-rename
Rename lldb-vscode -> lldb-dap
2024-01-20 08:54:45 -08:00
Adrian Prantl
b413c0d8df Rename lldb-vscode -> lldb-dap 2024-01-19 13:08:36 -08:00