Commit Graph

21 Commits

Author SHA1 Message Date
Tim Kientzle
05c74e0d90 Revert "Merge pull request #74394 from tbkka/tbkka-remotemirror-no-more-mpe-metadata-partial"
This reverts commit a1708ef8b1, reversing
changes made to b5930625be.
2024-06-14 15:32:39 -07:00
Tim Kientzle
c20ef6de2a Remove RemoteInspection code to fetch no-longer-used reflection metadata
without relying on spare bit information in the reflection metadata
(which was added in #40906).  As a result, we can remove the
code from #40906.

This is the first step in such removal.  It removes the RemoteMirror
code for looking up such metadata.  It leaves behind:

* Sufficient stubs for LLDB to continue to build.  Once LLDB is updated, these stubs can be removed as well.

* The compiler code to emit such metadata.  This allows new binaries to still reflect MPEs on older runtimes.  This will need to be kept for a transitional period.
2024-06-13 09:34:43 -07:00
Jonathan Grynspan
d35dcc8f9c Add swift5_tests to MetadataSections. (#71509) 2024-02-19 13:47:40 -05:00
Pavel Yaskevich
a5af302173 [stdlib] RuntimeMetadata: Register newly added "runtime attributes" section 2022-12-20 09:45:01 -08:00
Egor Zhdan
84a1ffcb33 [Shims] Include SwiftShims headers without ../
This replaces a number of `#include`-s like this:
```
#include "../../../stdlib/public/SwiftShims/Visibility.h"
```
with this:
```
#include "swift/shims/Visibility.h"
```

This is needed to allow SwiftCompilerSources to use C++ headers which include SwiftShims headers. Currently trying to do that results in errors:
```
swift/swift/include/swift/Demangling/../../../stdlib/public/SwiftShims/module.modulemap:1:8: error: redefinition of module 'SwiftShims'
module SwiftShims {
       ^
Builds.noindex/swift/swift/bootstrapping0/lib/swift/shims/module.modulemap:1:8: note: previously defined here
module SwiftShims {
       ^
```
This happens because the headers in both the source dir and the build dir refer to SwiftShims headers by relative path, and both the source root and the build root contain SwiftShims headers (which are equivalent, but since they are located in different dirs, Clang treats them as different modules).
2022-09-14 11:14:50 +01:00
Saleem Abdulrasool
a8b0ee24dc runtime: blanket application of namespacing and inclusion of new
Apply a blanket pass of including `new` for the placement new allocation
and namespacing the call to the global placement new allocator.  This
should repair the Android ARMv7 builds.
2022-04-14 14:21:12 -07:00
Jonathan Grynspan
845182252c Add exported symbol on non-Apple platforms to enumerate MetadataSection structures at runtime. 2022-03-04 23:44:10 -05:00
Tim Kientzle
4d91b45988 [RemoteMirror] Get spare bit info from reflection records (#40906)
This adds a new reflection record type carrying spare bit information for multi-payload enums.

The compiler includes this for any type that might need it in order to accurately reflect the contents of the enum. The RemoteMirror library will use this if present to determine how to project the contents of the enum. If not present (for example, in older binaries), the RemoteMirror library falls back on an internal calculation of the spare bitmask.

A few notes:
 * The internal calculation is not perfect.  In particular, it does not support MPEs that contain other enums (e.g., optionals).  It should accurately refuse to project any MPE that it does not correctly support.
 * The new reflection field is designed to be expandable; this might someday avoid the need for a new section.

Resolves rdar://61158214
2022-02-21 17:06:14 -08:00
Pavel Yaskevich
24b9c6486a [Distributed] Runtime: Add missing accessible function section registration on COFF 2022-02-10 09:20:51 -08:00
Jonathan Grynspan
099fdc2e41 Fix an issue on COFF/ELF targets where the runtime would register each loaded image twice (at least early on.) 2022-01-01 11:39:25 -05:00
Arnold Schwaighofer
cf3951394a Revert "Fix an issue on COFF/ELF targets where the runtime would register each loaded image twice (at least early on.)" 2021-12-21 07:15:08 -08:00
Jonathan Grynspan
7fe5ea7398 Fix an issue on COFF/ELF targets where the runtime would register each loaded image twice (at least early on.) 2021-12-20 15:15:02 -05:00
Augusto Noronha
5cee6f3d6a Unify 'MetadataSections' data structure, as well as common ELF and COFF procedures 2020-06-29 19:35:44 -03:00
Arnold Schwaighofer
0297476da5 Add missing swiftrt-coff change 2019-05-22 11:23:17 -07:00
Saleem Abdulrasool
d845e7bdbf runtime: force unaligned start/stop markers
The sections to which the start/stop symbols are being applied do not
guarantee pointer alignment.  In particular, the field metadata is
aligned to a 4-byte boundary, which is less then the pointer alignment
of `uintptr_t`.  This results in extra padding in the data which is
going to cause the iteration to run off the end.  A similar byte
alignment is forced for the markers in the ELF case as well.  This fixes
one of the reflection tests on Windows where we were attempting to
decode the padding as an entry.
2019-04-07 12:12:13 -07:00
Arnold Schwaighofer
152e8db8bb IRGen and runtime implementation for dynamic replacements 2018-11-06 09:58:36 -08:00
Saleem Abdulrasool
76d7bfd8ed runtime: ensure that the module constructor element is RO
The default attribute on the section is read/write.  This would cause
the section to have different attributes when compiled.  The linker
would then preserve the section rather than merge it into the right
location.  This was noticed when linking with `link.exe`.
2018-02-02 15:01:44 -08:00
Saleem Abdulrasool
bb55044f38 runtime: add missing sw5prt to the section list
The Windows constructor was not populated properly, with the protocol
list being dropped.  Ensure that all the fields are initialised
properly.  Thanks to clang's `-Wmissing-field-initializers` warning to
help catch this.
2018-02-02 15:00:34 -08:00
Saleem Abdulrasool
bc950fd41a runtime: mark the section markers with the correct attributes
On windows, we create synthetic markers with grouping identifiers to
ensure that the markers are sorted properly and merged.  We would
previously mark the section as read/write rather than read-only causing
warnings when linking.  Correct the attributes.  This ensures the proper
linking of the modules.
2018-02-02 14:56:23 -08:00
Arnold Schwaighofer
8e71f34517 One more place I missed in the swift5 rename 2018-01-22 10:23:51 -08:00
Saleem Abdulrasool
899103cfa8 COFF: restructure metadata registration
Restructure the COFF metadata handling to use the linker section
grouping to emit section start/stop markers in the appropriate location.
This allows us to lookup the sections statically without having to the
walk the entire image structure.

Introduce a constructor for PE/COFF binaries.  This will ensure that the
registration occurs for all modules appropriately.  This should resolve
rdar://problem/19045112.  The registration should occur prior to
`DllMain` being invoked from `DllMainCRTStartup`.
2017-12-08 16:15:07 -08:00