Commit Graph

1659 Commits

Author SHA1 Message Date
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
Doug Gregor
ac0f574fdb Merge pull request #75127 from carlos4242/embedded-avr-cross-compile-stdlib
[AVR] standard library support for AVR
2024-07-17 22:17:42 -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
Alex Lorenz
6a7be95027 Merge pull request #74754 from hyp/eng/android-compiler-rt-buildps1
[windows][toolchain] build  android compiler-rt builtins when buildin…
2024-07-16 12:35:42 -07:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
Alex Lorenz
063a41c308 fix formatting 2024-07-15 13:03:13 -07:00
Alex Lorenz
c6c62e1763 Drop the arm64 changes
build ps1 is currently not able to compile the arm64 builtins correctly
2024-07-15 13:01:21 -07:00
Alex Lorenz
bd2c3ea53b [windows][toolchain] build android compiler-rt builtins when building Android SDK with build.ps1 2024-07-12 17:22:13 -07:00
Alexander Cyon
4a2942bb4e Fix typos in: cmake, tools, utils, unittests, validation-test
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2024-07-12 02:34:00 +03:00
Alastair Houghton
7268640b60 Merge pull request #74731 from al45tair/eng/PR-116525111
[Build][Linux] Set `--build-id=sha1` for the linker.
2024-06-28 11:31:36 +01:00
Alastair Houghton
35f123bbbf [Build][Linux] Set --build-id=sha1 for the linker.
This means we will get build IDs in the tools and standard library,
which is useful for debugging (it lets us associate debug symbols with
the binaries later on, as well as allowing us to reliably identify
exactly which binary we are looking at).

rdar://116525111
2024-06-27 12:21:50 +01:00
Rintaro Ishizaki
5ebd715a2a Merge pull request #73725 from rintaro/macros-inproc-plugin
[Macros] In-process plugin server
2024-06-26 06:33:38 -07:00
Saleem Abdulrasool
c048449694 caches: add clang-features-file to the install components
This ensures that we distribute the features.json for clang in the
toolchain distribution image which is used for building the image.
2024-06-25 14:02:01 -07:00
Rintaro Ishizaki
2f7aa428db [Macros] In-process plugin server
Separate swift-syntax libs for the compiler and for the library plugins.
Compiler communicates with library plugins using serialized messages
just like executable plugins.

* `lib/swift/host/compiler/lib_Compiler*.dylib`(`lib/CompilerSwiftSyntax`):
  swift-syntax libraries for compiler. Library evolution is disabled.
* Compiler (`ASTGen` and `swiftIDEUtilsBridging`) only depends on
  `lib/swift/host/compiler` libraries.
* `SwiftInProcPluginServer`: In-process plugin server shared library.
  This has one `swift_inproc_plugins_handle_message` entry point that
  receives a message and return the response.
* In the compiler
  * Add `-in-process-plugin-server-path` front-end option, which specifies
    the `SwiftInProcPluginServer` shared library path.
  * Remove `LoadedLibraryPlugin`, because all library plugins are managed
    by `SwiftInProcPluginServer`
  * Introduce abstract `CompilerPlugin` class that has 2 subclasses:
    * `LoadedExecutablePlugin` existing class that represents an
      executable plugin
    * `InProcessPlugins` wraps `dlopen`ed `SwiftInProcPluginServer`
  * Unified the code path in `TypeCheckMacros.cpp` and `ASTGen`, the
    difference between executable plugins and library plugins are now
    abstracted by `CompilerPlugin`
2024-06-17 11:36:52 -07:00
Alex Lorenz
c8b5344d3e Merge pull request #72014 from compnerd/android
utils: support building android SDKs on Windows
2024-06-07 12:37:00 -07:00
Egor Zhdan
cb2f23f3de Merge pull request #74006 from apple/egorzhdan/remove-ios-32bit
[build] Remove unused `SWIFT_ENABLE_IOS32` CMake flag
2024-05-30 22:11:38 +01:00
Egor Zhdan
7d754db19a [build] Remove unused SWIFT_ENABLE_IOS32 CMake flag
This removes the unused legacy CMake flag: `SWIFT_ENABLE_IOS32`.

Support for targeting 32-bit iOS was removed in 2022 in https://github.com/apple/swift/pull/60363.
2024-05-30 15:19:59 +01:00
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