Commit Graph

255 Commits

Author SHA1 Message Date
Adrian Prantl
75bee892be Add LLDB and swift-reflection-dump support for WebAssembly
This patch adds parsing and extracting of the Swift reflection
metadata data segments from within the WebAssembly DATA section and
tests it using swift-reflection-dump. This is needed to allow LLDB to
acces Swift reflection metadata when attached to WebAssembly
processes.

rdar://159217213
2025-08-27 17:14:17 -07:00
Evan Wilde
5eb727b668 Merge pull request #83908 from etcwilde/ewilde/freebsd-disable-known-failures
FreeBSD: Disable known/in-progress test failures
2025-08-27 10:30:53 -07:00
Evan Wilde
dfccee66ad FreeBSD: Disable missing reflection metadata tests
LLD relocates some of the metadata sections resulting in bad offsets at
runtime.

The workaround is to pass `-no-rosegment` to the linker invocation.

rdar://159139154
2025-08-25 15:32:33 -07:00
Slava Pestov
831043c132 IRGen: Fix crash trying to emit capture descriptor involving element archetype
We could encode local archetypes in reflection info by performing the
local archetype transform, to get an extended generic signature together
with substitutions for the added generic parameters.

However, for now, let's just not crash. This generalizes an earlier hack
for opened existential archetypes. Instead of replacing them with
nonsensical type parameters though, let's just not emit the whole
descriptor.

- Fixes https://github.com/swiftlang/swift/issues/83539.
- Fixes rdar://157554723.
2025-08-25 12:42:49 -04:00
Augusto Noronha
50de07ab8f Enable two reflection tests on Linux (aarch64)
With the changes in b6ce889c8d, these
might be fixed.
2025-07-18 16:22:26 -07:00
Augusto Noronha
b6ce889c8d [RemoteMirrors] Fix losing the remote address on StaticMirror
The Offset field of a DynamicRelocation is either an offset or a remote
address, but was being treated only as a remote address on
getDynamicSymbol.
2025-07-11 16:33:19 -07:00
finagolfin
b2f52524c5 [android] Disable a couple Reflection tests and fix an install path (#82620)
The tests broke on the community Android CI since #82325, and I just
noticed the install issue when cross-compiling Testing with a
freshly-built compiler, which I'd never done before. Also, fix the NDK
path shown in the CMake output.
2025-07-02 09:41:59 +05:30
Mike Ash
cef762bcf9 [Test] Disable chained fixups for typeref_decoding_asan.swift.
ObjectFileContext doesn't currently support chained fixups. We previously disabled chained ifxups in some other reflection tests but not this one.

rdar://137532051
2025-05-20 12:24:24 -04:00
Slava Pestov
70b413dc56 RemoteInspection: Support for parameter packs 2025-05-09 14:49:37 -04:00
Hamish Knight
bc5c8f51bd [test] Fix extension macros in test suite
Make sure we're using `providingExtensionsOf` as the extended type,
previously we were just using the unqualified name of the decl.
2025-03-28 21:35:59 +00:00
Mike Ash
10feb11d27 [Test] Disable chained fixups when building a few reflection tests.
ObjectFileContext doesn't currently support chained fixups. For now, avoid building the test binaries with chained fixups to avoid issues.

This adds a %no-fixup-chains substitution which resolves to -Xlinker -no_fixup_chains on Darwin, and to nothing on everything else.

rdar://145442500
2025-02-25 13:54:42 -05:00
Stefan Gränitz
76243a25db [windows][toolchain] Build sanitizers and builtins standalone for all SDKs (#78861)
Unified builds of compiler-rt together with LLVM failed for the Android SDKs. It got too complicated to redirect the way LLVM would configure the nested build-trees. Standalone builds slightly increase build time, but they turned out much simpler and we end up with less duplication of definitions.
2025-01-28 22:08:07 +01:00
Alejandro Alonso
cedea94b4c Test fixes and review feedback 2025-01-09 15:54:54 -08:00
Alejandro Alonso
c62e851e38 Implement RemoteInspection support for Builtin.FixedArray 2025-01-08 10:37:17 -08:00
Hiroshi Yamauchi
32832dd1e1 Revert "[windows][toolchain] Enable builtins and sanitizers"
Revert https://github.com/swiftlang/swift/pull/77770

To fix CI https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/785/consoleText
2024-12-06 14:22:30 -08:00
Stefan Gränitz
2f7116a36f Disable tests newly included with asan_runtime available, but not supported on Windows yet 2024-12-03 18:41:49 +01:00
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
Venkatesh Sriram
0d9e62e143 Merge pull request #76917 from venkatesh5789/external-conformance-info
[Compile Time Constant Extraction] Add information about where a particular conformance has been defined
2024-10-17 10:19:07 -07:00
Venkatesh Sriram
9ca55fdf89 [Compile Time Constant Extraction] Add information about where a particular conformance has been defined 2024-10-15 15:46:21 -07:00
Mike Ash
53c6d5b1fe [Tests][Reflection] Fully disable typeref_decoding_asan on Linux aarch64.
We XFAILed it but it's still passing sometimes.
2024-10-11 08:57:52 -04:00
Mike Ash
36102bad19 [Tests][Reflection] Re-disable typeref_decoding_asan on Linux aarch64.
This test was failing for a long time, spontaneously started working, and now seems to have spontaneously started failing again. Turning it back off, just on Linux aarch64, until we can figure out how to fix it.

rdar://137532051
2024-10-09 16:58:56 -04:00
Ben Langmuir
b5f290dc49 [test] Move to earlier deployment target as workaround
We are already using 5.4 target as a workaround for missing
LC_DYLD_CHAINED_FIXUPS support in reflection tools, but we need to
further workaround a linker bug in older versions of ld-prime that
caused appletv simulator platform to be misidentified and use chained
fixups earlier than it should, so move back to 5.2.
2024-08-30 14:03:04 -07:00
Ben Langmuir
5d111db75a Add explicit targets to Reflection tests due to chained fixups issue
When the deployment target is newer than swift-5.4 these tests fail due
to missing/incomplete support for chained fixups.

rdar://134809489
2024-08-29 07:55:14 -07:00
Alastair Houghton
1925242c2d [Tests][Reflection] typeref_decoding_asan now passes on aarch Linux.
This test now passes; presumably we fixed something that was causing
it to fail.

rdar://134053352
2024-08-16 16:03:25 +01:00
artemcm
e7ba93f20f Restrict preserve_conformance_metadata_attr_macros.swift test to OS supported by binary metadata reading tooling 2024-05-24 09:15:53 -07:00
Augusto Noronha
dd39730d74 Merge pull request #73723 from augusto2112/default-actor-ti-main
[RemoteInspection] Hardcode DefaultActorStorage's type info
2024-05-22 11:14:47 -07:00
Augusto Noronha
4417786be4 [RemoteInspection] Hardcode DefaultActorStorage's type info
No metadata is emitted for the builtin DefaultActorStorage type. Since
its layout is fixed, hardcode its definition in Remote Mirrors.

rdar://128032250
2024-05-17 14:29:25 -07:00
artemcm
c47cd7a107 Apply the @_alwaysEmitConformanceMetadata semantics to conformances originating from macro-expanded declarations and extensions
Existing code does not visit such declarations and does not mark them to be preserved in the binary even if not public and used.

Resolves rdar://127903662
2024-05-16 15:58:11 -04:00
Ben Barham
c1031b4844 [Test] Temporarily mark typeref_decoding.swift as unsupported
This seems to be failing on Linux aarch64 on and off. Mark unsupported
while we investigate.
2024-05-10 09:43:18 -07:00
Konrad `ktoso` Malawski
2f361ae9e1 XFAIL typeref_decoding.swift (#73537) 2024-05-10 09:09:04 +09:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -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
Meghana Gupta
2d3d74b4eb Disable test Reflection/preserve_conformance_metadata_attr.swift 2024-04-08 11:55:18 -07:00
Slava Pestov
480592a7d5 Merge pull request #72847 from slavapestov/fix-rdar123645784
Fix two problems with opaque return types -vs- parameter packs
2024-04-05 07:31:34 -04:00
Slava Pestov
153da37521 IRGen: Use getMaximalTypeExpansionContext() 2024-04-04 19:36:25 -04:00
Artem Chikin
69fdc1356c Revert "Revert "Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute"" 2024-04-03 09:29:51 -07:00
Mishal Shah
74840cc60a Revert "Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute" 2023-11-06 22:41:12 -08:00
Artem Chikin
feb5d457f6 Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute
Ensuring that conformances to such protocols must have their type metadata always emitted into the binary, regardless of wheter they are used or `public`.
2023-11-02 09:26:08 -07:00
Arnold Schwaighofer
894095a5f2 Add a flag to enable/disable usage of objective c protocol symbolic references 2023-10-06 08:43:00 -07:00
Arnold Schwaighofer
b0424759d7 Add support for objective c protocol symbolic references
Using symbolic references instead of a text based mangling avoids the
expensive type descriptor scan when objective c protocols are requested.

rdar://111536582
2023-10-05 13:11:32 -07:00
Finagolfin
30ba49e7fa [android][test] Fix a handful of tests and disable one CxxToSwiftToCxx bridging test
Also, make the analogous change to apple/swift-driver#1372, which gets the
sanitizer tests working on Android again, and remove the lld_lto feature in the
tests, which is now unused.
2023-08-12 16:36:35 +05:30
Artem Chikin
0fae0b4708 Re-enable now-passing 'Reflection/typeref_decoding.swift' 2023-04-27 16:49:13 -07:00
Tim Kientzle
b36de6a0fb XFAIL the other typeref decoding tests on Linux aarch64 2023-04-12 17:19:48 -07:00
Slava Pestov
cca91797ed IRGen: Hollow out NecessaryBindings
This removes the "optimization" where a function type, metatype or
tuple type was split up into structural components, because it seems
that in general we need this structural type metadata again.

Similarly, this no longer tries to split up dependent concrete
conformances and instead passes the witness table in the context.

This makes the context larger potentially, but it avoids calls to
metadata access functions and swift_getWitnessTable() every time the
closure is invoked.
2023-03-28 19:21:45 -04:00
Tim Kientzle
f087b5e0fb This PR aligns RemoteMirror more closely with the compiler's handling of enums
that contain zero-sized payloads, which should resolve a number of issues with
RemoteMirror incorrectly reflecting enum cases and/or measuring the layout of
structures containing enums.

Background: Enum cases that have zero-sized payloads are handled
differently from other payload-bearing cases.

1. For layout purposes, they're treated as
   non-payload cases.  This can cause an MPE to
   actually get represented in memory as a single-payload
   or non-payload enum.

2. However, zero-sized payloads are still considered for
   extra inhabitant calculations.  Since they have no
   extra inhabitants, this tends to cause such enums to
   also not expose extra inhabitants to containing enums.

This commit makes several change to how RemoteMirror determines
enum layout:

* The various "*EnumTypeInfo" classes now represent
  layout mechanisms -- as described in (1) above,
  this can differ from the source code concept.

* An Enum "kind" is separately computed to reflect the
  source code concept; this ensures that the dumped
  type information reflects the source code.

* For single-payload and no-payload _layouts_,
  the extra inhabitant calculation has been adjusted
  to ensure that zero-sized payloads are correctly
  considered.

Resolves: rdar://92945673
2023-01-06 11:16:07 -08:00
Slava Pestov
e4e2e034c0 IRGen: Workaround for inadvertent mangling of opened archetypes 2022-11-02 13:27:26 -04:00
Adrian Prantl
75c42ed43b [swift-reflection-dump] Turn --binary-filename into a positional argument.
I mostly find it annoying to type and this makes the usage of the tool more
consistent with other similar tools like dwarfdump or otool.
2022-10-12 11:18:59 -07:00
Arnold Schwaighofer
c91bc61f1a Disable Reflection/typeref_decoding(_asan).swift tests
They fail on arm64e on some bots.

rdar://100805115
2022-10-05 06:22:00 -07:00
Mike Ash
373000eb1d [Test] Re-disable some Reflection tests on ARM64e.
These tests are still broken on ARM64e:

Reflection/conformance_descriptors.swift
Reflection/typeref_decoding_imported.swift
Reflection/typeref_decoding_objc.swift
Reflection/typeref_lowering.swift

rdar://100558042
2022-09-29 09:07:20 -04:00
Mike Ash
cdfbd7b91d [Test] Reenable Reflection tests disabled on ARM64e.
Improvements in our ARM64e support seems to have made these test work again.

rdar://89754240
rdar://89986398
2022-09-22 11:16:21 -04:00