Commit Graph

111 Commits

Author SHA1 Message Date
David Smith
0843891eb9 Switch to malloc_good_size instead of malloc_size (#70532)
Switch to malloc_good_size instead of malloc_size
2024-01-27 19:20:33 -08:00
Kuba Mracek
2c30b0a0e2 [embedded] Resolve ptrauth crashes by signing HeapObjects's isa pointers in embedded Swift 2024-01-22 16:45:07 -08:00
Allan Shortlidge
582c0de28c NFC: Add _Null_unspecified _swift_stdlib_getEnviron() declaration.
Makes the BSD and `__APPLE__` branches consistent and suppresses the following
warning:

```
warning: pointer is missing a nullability type specifier
```
2024-01-16 13:27:55 -08:00
Saleem Abdulrasool
6f9a28921a SwiftShims: silence a deprecation warning on Windows
Silence a deprecation warning on Windows by using the Microsoft
extension.
2023-12-05 07:51:20 -08:00
Kuba Mracek
df09cf16b1 [embedded] Avoid using swiftcc on targets that don't support it 2023-11-13 12:59:41 -08:00
swift-ci
e83a375e20 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 06:36:52 -07:00
Yuta Saito
cdc47aabfb [WASILibc] Exclude semaphore APIs from overlay
Since wasi-libc does not support those APIs
2023-10-06 01:49:30 +00:00
swift-ci
75ce2f5734 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-03 07:13:54 -07:00
Kuba Mracek
d579c62fee [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3 2023-10-02 17:55:02 -07:00
swift-ci
a230c675b6 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-02 13:55:10 -07:00
Kuba Mracek
268a1e3556 Revert "[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 2"
This reverts commit a1a48b5c83.
2023-10-02 09:35:21 -07:00
swift-ci
e565849dd4 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 12:58:02 -07:00
Kuba Mracek
a1a48b5c83 [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 2 2023-09-28 09:17:32 -07:00
swift-ci
39f5388c07 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-27 10:16:49 -07:00
Kuba (Brecka) Mracek
859ce6b9a4 Merge pull request #68783 from kubamracek/embedded-posix-memalign
[embedded] Fix a warning in LibcShims.h about missing nullability annotations
2023-09-27 10:03:12 -07:00
Kuba Mracek
a46abb0cf8 [embedded] Put __ptrauth specifier at the right spot so that it parses even in C++ mode 2023-09-26 17:32:35 -07:00
Kuba Mracek
1d24e0b343 [embedded] Fix a warning in LibcShims.h about missing nullability annotations 2023-09-26 16:23:50 -07:00
Kuba Mracek
8009f45b05 [embedded] Avoid warning about redefined macro by using attributes directly 2023-09-26 16:16:13 -07:00
Kuba Mracek
b718c506da [embedded] Fix arm64e pointer signing in embedded heap object destruction 2023-09-26 16:13:03 -07:00
Evan Wilde
700aa8aa70 Merge remote-tracking branch 'upstream/main' into rebranch
Merge conflict while removing `nocapture` from
`s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF`. Resolution
was to remove nocapture from the expected output in both cases:
```
// CHECK-LABEL: define swiftcc void @"$s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF"(ptr noalias[-nocapture-] %0, ptr %T, ptr %T.P)
```

Conflict cause: 4858cb6225
This is the same as the original change to this file. The conflict seems
to be due to the next line changing, when moving from llvm.dbg.addr to
llvm.dbg.value.

Conflicts:
  test/DebugInfo/move_function_dbginfo.swift
2023-09-26 13:36:57 -07:00
Kuba Mracek
0758e7da85 [embedded] Use posix_memalign from shims instead of manual declaration 2023-09-25 19:51:19 -07:00
Kuba Mracek
86ad378928 [embedded] Add a simple Swift runtime, written in embedded Swift 2023-09-25 19:51:19 -07:00
swift-ci
064f3ce0b1 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-01 23:54:18 -07:00
Doug Gregor
5927527419 Switch order of _WIN64/_WIN32 checks in computation of C types for Int/UInt
64-bit Windows defines both _WIN64 and _WIN32, so the logic here would
always end up defining 32-bit C types for Swift's `Int` and `UInt`.
Fix the ordering to check for 64-bit first, then 32-bit second.

Note that the SwiftShims version of this code has always been wrong,
but it's completely benign because SwiftShims is only used in the
Swift runtime itself, which is built with Clang (on all platforms),
and doesn't need to go through this code path. Still, we fix it in both
places, so we don't get a nasty surprise if the SwiftShims version of
the header later gets included in a non-Clang C++ compiler.
2023-09-01 12:40:46 -07:00
swift-ci
18a5500852 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-23 14:53:02 -07:00
Volodymyr Sapsai
4c480d5fa7 Add and install a parent module map for Swift shims. NFC intended.
Header search path for Swift shims is "usr/lib/swift". Don't rely on
clang looking for module maps in immediate subdirectories like "shims"
but add a module map to "usr/lib/swift" sourcing "shims" modules.

rdar://106677321
2023-08-22 12:16:46 -07:00
Eric Miotto
72cd8bfdcf [CMake] adjust clang resource dir symlinks to new path (#66983)
As a result of https://github.com/llvm/llvm-project/commit/e1b88c8a09be
we should expect it to contain only the major version, not the full one
-- that is, we should expect it to be

```
../lib/clang/CLANG_VERSION_MAJOR
```

instead of

```
../lib/clang/CLANG_VERSION_MAJOR.CLANG_VERSION_MINOR.CLANG_VERSION_PATCH
```

Also update the logic to levarage directly the Clang version -- this can
be different from the LLVM one (as per
ebfc680685)

Addresses rdar://111452821
2023-07-31 12:57:15 -07:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
David Smith
e20be0edc6 Revert [Runtime] Let CF provide us with state, avoiding runtime lookup. rdar://111104451 (#66606) 2023-06-22 10:24:51 -07:00
David Smith
7eb8283a49 [Runtime] Let CF provide us with state, avoiding runtime lookup. rdar://111104451 (#66606)
Provide a hook for CF to tell us about the state we need from it, rather than us having to look it up at runtime
2023-06-21 08:38:14 -07:00
Yuta Saito
c3a4ba0b74 [wasm][stdlib] Stop including stdint.h in wasi-libc for SwiftShims
To avoid `error: 'stddef.h' file not found' issue described in
SwiftStdint.h
2023-06-20 17:48:01 +00:00
Alastair Houghton
43ed01f08f [Backtracing][Linux] Reorganise modules for _Backtracing.
Using `SwiftShims` is undesirable - it creates all kinds of build issues,
and means shipping the `_SwiftBacktracing.h` header in the SDK, which is
not necessary.

While we're doing this, add the necessary definitions for reading ELF
and DWARF information.

rdar://110261712
2023-06-06 16:16:20 +01:00
Alastair Houghton
e5680de071 [Backtracing] Security improvements.
Use `task_read_for_pid()` rather than having the crashing program pass its
own task port through.  This opts us in to additional OS security measures
surrounding the use of this call.

rdar://107362003
2023-04-12 12:48:33 +01:00
Alex Lorenz
48503bfadd [shims] ensure that _SwiftConcurrency has the same Swift interface regardless of whether C++ interop is enabled
This ensures that a module built from Swift interface file (and as such interop is disabled),
that references 'exit' (from _SwiftConcurrencyShims module) can resolve the module reference to
'exit' even when it's being imported when interop is enabled (and thus it loads a different underlying _SwiftConcurrencyShims).
2023-03-28 18:42:26 -07:00
Alejandro Alonso
09b1476ddf Stop building Reflection 2023-03-14 11:49:38 -07:00
Alastair Houghton
d1f725c511 [Backtracing] Replace all the stdint types with Swift specific variants.
This is needed because we can't include `<stdint.h>` or `<inttypes.h>`
on Darwin without dragging in the Darwin package.

The previous solution was some icky `#define` nonsense.  This is
better.

rdar://106234311
2023-03-06 11:47:59 +00:00
Alastair Houghton
1258d45152 [Backtracing] Build work.
Additional shimming required for some builds, as well as a few other build
related tweaks.

rdar://106234311
2023-03-04 15:46:30 +00:00
Alastair Houghton
a2fc8c3d69 [Backtracing] Only include libproc.h if it's present.
rdar://104336548
2023-03-04 07:56:03 +00:00
Alastair Houghton
1e71f92b8e [Backtracing] Don't try to include <libproc.h> for iOS.
iOS doesn't have <libproc.h>.  We don't need it anyway there.

rdar://104336548
2023-03-04 07:56:03 +00:00
Alastair Houghton
36c2e4c694 [Backtracing] Fix OS conditionals so iOS builds work.
Some of the `TARGET` and `os()` conditionals needed to be updated.

rdar://104336548
2023-03-04 07:56:03 +00:00
Alastair Houghton
6caea5386b [Backtracing] Add _Backtracing library to the build.
Adds a new swift_Backtracing library, with a corresponding _Backtracing
module, to the build.  Also add some tests.

This is not public API at this point, but will be used by the external
backtracing program, `swift-backtrace`.

rdar://104336548
2023-03-04 07:56:03 +00:00
Alastair Houghton
2f0e379324 [Backtracing] Needed to add some code to this header for the runtime.
In order for the runtime PR to work as a separate PR, it does need a little
bit of code in the `_SwiftBacktracing.h` header in SwiftShims.

rdar://105391747
2023-03-04 07:56:02 +00:00
swift-ci
c13464d5f4 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-26 11:33:10 -08:00
Alejandro Alonso
ef9db6021f [Reflection] Remove folder in shims (#63231) 2023-01-26 11:17:51 -08:00
swift-ci
ce7f90aaef Merge remote-tracking branch 'origin/main' into rebranch 2023-01-17 09:34:30 -08:00
Alejandro Alonso
c7a9360806 [Reflection] Build the _Runtime and Reflection modules (#62973)
* Move Runtime into _Runtime

Fix more _Runtime names

* Add availability to all API

* Build _Runtime and Reflection modules

* Use threading's mutex for all platforms

add stdlib include
2023-01-17 09:30:16 -08:00
swift-ci
cb3a8e8553 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-12 04:40:13 -08:00
Jonathan Grynspan
b2bbf00bd7 Remove unused infrastructure added for runtime attributes (#62971) 2023-01-12 04:16:45 -08:00
swift-ci
f476abf4a1 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-20 17:13:36 -08:00
Pavel Yaskevich
a5af302173 [stdlib] RuntimeMetadata: Register newly added "runtime attributes" section 2022-12-20 09:45:01 -08:00