Commit Graph

156 Commits

Author SHA1 Message Date
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
Kuba Mracek
0a678670cd [embedded] Add a CMake setting for building Embedded Swift stdlib for custom target triples 2025-01-30 10:43:59 -08:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00
Kuba Mracek
65cd10a87f [embedded] Start building embedded stdlib for arm64-apple-ios + arm64e-apple-ios 2024-12-03 16:24:12 -08:00
Kuba Mracek
d06f2cbb76 [embedded] Add armv7m-apple-none-macho as an embedded cross-compiling target 2024-10-10 15:27:46 -07:00
Kuba (Brecka) Mracek
39161a2cc8 Merge pull request #76751 from kubamracek/embedded-none-macho-arm64e
[embedded] Also build arm64e on top of arm64 for -apple-none-macho triple
2024-09-27 17:35:50 -07:00
Kuba Mracek
eb1f9f74c5 [embedded] Also build arm64e on top of arm64 for -apple-none-macho triple 2024-09-27 10:12:53 -07:00
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Eric Miotto
5512833d18 Promote _Concurrency and StringProcessing to core subset of the stdlib
This is needed to support Apple internal configurations.

Addresses rdar://125909114
2024-07-29 08:58:04 -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
Kuba (Brecka) Mracek
9caf750e7f Merge pull request #74536 from kubamracek/embedded-windows1
[embedded] Start building embedded stdlib on Windows
2024-06-24 12:22:24 -07:00
Kuba Mracek
6eeef12849 [embedded] Add a embedded-libraries CMake target to simplify the test dependencies 2024-06-23 13:08:01 -07:00
Kuba Mracek
187f772d09 [embedded] Start building embedded stdlib on Windows 2024-06-21 21:32:52 -07:00
Kuba (Brecka) Mracek
9e7501601c Merge pull request #74489 from kubamracek/embedded-less-stdlibs
[embedded] Don't build *all* the embedded stdlibs by default
2024-06-18 13:50:25 -07:00
Kuba Mracek
37ed08dc7b Add a build-script + CMake flag to enable/disable building the _Volatile module 2024-06-17 13:18:55 -07:00
Kuba Mracek
dc2edb6e9b [embedded] Don't build *all* the embedded stdlibs by default 2024-06-17 10:32:56 -07:00
Harlan Haskins
1b36983b8b Add armv4t for GBA programming (#73005) 2024-04-13 18:11:16 -06:00
Kuba (Brecka) Mracek
f9ed12d781 Merge pull request #72716 from kubamracek/embedded-build-macos-as-14
[embedded] Build the macOS Embedded Stdlib with a recent deployment target
2024-04-09 19:11:08 -07:00
Kuba Mracek
90c8a8e90e Add experimental _Volatile module providing low-level primitives for MMIO 2024-04-05 15:13:03 -07:00
Kuba Mracek
a35db85e82 [embedded] Build the macOS Embedded Stdlib with a recent deployment target 2024-03-29 16:10:35 -07:00
Mike Ash
41cd0ead61 Merge pull request #72501 from mikeash/remove-externalgenericmetadatabuilder
[Runtime] Remove ExternalGenericMetadataBuilder.
2024-03-22 16:03:26 -04:00
Mike Ash
0491192337 [Runtime] Remove ExternalGenericMetadataBuilder. 2024-03-21 17:56:17 -04:00
Ian Anderson
54927e27f4 [CMake] Move ClangOverlays (_Builtin_float) to Core
The _Builtin_float overlay layers under the Libc overlays, and so it needs to be in the core stdlib group.

rdar://125068518
2024-03-20 12:51:40 -07:00
Kuba Mracek
18d2ac14e9 [embedded] Fix a typo in the module name for armv6m-none-none-eabi 2024-03-13 21:28:30 -07:00
Kuba Mracek
48b8228acd [embedded] Start building Synchronization in embedded Swift mode 2024-03-13 10:07:37 -07:00
Doug Gregor
0c9c734f7e Merge pull request #71722 from DougGregor/diagnostic-style-swift-default 2024-02-24 14:42:38 -10:00
Doug Gregor
8ed35de4e0 Switch to the 'Swift' diagnostic style as the default 2024-02-19 02:48:23 -10:00
Ian Anderson
1ce3935eb7 [overlay] Make an overlay for the clang _Builtin_float module
Clang's builtin float.h is no longer included in OS/SDK modules, and so it needs its own overlay.

rdar://122351557
2024-02-16 12:31:47 -08:00
Eric Miotto
28e2f079b5 CMake: on Darwin be explicit about inclusion in the dyld shared cache (#70856)
This entails passing a linker flags to Apple linkers when the standard
library is not meant for inclusion in such cache.

For this to have effect on every library, propagate link flags when
building _Concurrency and Observation.

This is needed for Apple internal configurations.

Addresses rdar://120653968
2024-01-29 09:42:38 -08:00
Max Desiatov
670e8a8a2b Replace pc component with unknown in stdlib/CMakeLists.txt 2024-01-28 08:03:10 +00:00
Max Desiatov
426c4f9f1c Add i686-pc-windows-coff/x86_64-pc-windows-coff embedded triples
These triples don't need additional adjustments in the standard library and complement existing embedded triples for i686 and x86_64 CPU architectures.
2024-01-27 21:10:11 +00:00
Max Desiatov
633d5bc45a Enable x86_64 and i686 ELF triples for embedded Swift (#70642)
This is just as useful for x86 bare metal as the already enabled `arm*-none-none-eabi` triples.
2024-01-26 21:39:17 +00: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
Alejandro Alonso
e37ecac163 Merge pull request #68857 from Azoy/atomics
[stdlib] Atomics
2024-01-10 12:03:08 -08:00
Max Desiatov
bf655c14ef Add wasm64-unknown-none-wasm triple to stdlib/public/CMakeLists.txt 2024-01-02 17:13:12 +00:00
Max Desiatov
d10405ec1e Use wasm32-unknown-none-wasm triple in stdlib/public/CMakeLists.txt 2024-01-02 17:08:00 +00:00
Max Desiatov
2730e16f38 Fix missing quote in stdlib/public/CMakeLists.txt 2023-12-26 18:47:37 +00:00
Max Desiatov
f2c804a724 Fix use of wasm32 arch in `stdlib/public/CMakeLists.txt 2023-12-26 14:16:14 +00:00
Max Desiatov
c56085a66c stdlib/public/CMakeLists.txt: Enable embedded Wasm
Running `swiftc` with `wasm32-none-none` or `wasm32-unknown-none` currently fails, as this embedded target is not built. Let's include it in the list of embedded targets.
2023-12-26 14:12:32 +00:00
Alejandro Alonso
2c0b473b8d Add Synchronization module 2023-12-18 14:01:16 -05:00
Alejandro Alonso
6d6e55a931 Apply feedback from pitch 2023-12-18 14:01:15 -05:00
Alejandro Alonso
ae983d8f84 Add Synchronization module 2023-12-18 14:01:14 -05:00
Eric Miotto
4ab800e1a4 CMake: allow to build embedded stdlib in a standalone preset (#70238)
This would be needed to support Apple internal configurations.

Addresses rdar://119192035
2023-12-06 08:35:02 -08:00
Daniel Rodríguez Troitiño
f0594a4190 [embedded] Make embedded target triples conditional on LLVM support (#70218)
LLVM might not be build with support for all architectures to save time.
The changes in this commit check the value of LLVM_TARGETS_TO_BUILD
provided by LLVMConfig.cmake to add or skip the different embedded
targets if LLVM happens to not build with support for that target.

While x86_64 and ARM/AArch64 are very common in `LLVM_TARGETS_TO_BUILD`,
targets like RISCV are more specialized and might not be always enabled.

This is not a problem for builds using the `build-script` because of the
changes introduced in #70057, but it is still a problem for other builds
that do not use `build-script`. This solution should work for any build.
2023-12-05 12:39:04 -08:00
Kuba Mracek
a0ec73ef42 [embedded] Start building embedded support on Linux/ELF, expand archs of the embedded stdlib to cover common embedded targets, take 2 2023-11-28 10:31:39 -08:00
Doug Gregor
130adac5c5 Revert "[embedded] Start building embedded support on Linux/ELF, expand archs of the embedded stdlib to cover common embedded targets" 2023-11-27 22:20:54 -08:00
Kuba Mracek
971ad79f37 [embedded] Start building embedded support on Linux/ELF, expand archs of the embedded stdlib to cover common embedded targets 2023-11-17 21:30:12 -08:00
Eric Miotto
3d71dbb04b CMake: allow to only build Core and Onone when building the stdlib (#69747)
This is needed for some Apple internal configurations that needs to build the
standard library in pieces to construct an SDK.
Given the limited audience, only introduce this flag in CMake.

Addresses rdar://118178539
2023-11-09 14:06:42 -08:00