Commit Graph

14 Commits

Author SHA1 Message Date
Jonathan Grynspan
8feba8d584 Use __ehdr_start on ELF instead of calling dladdr(). (#85012)
This PR replaces our use of `__dso_handle` and (indirectly) `dladdr()`
when figuring out the base address of loaded Swift images on ELF-based
platforms. Instead, we use `__ehdr_start` which refers to the start of
the image's ELF header (i.e. the start of the file) and is provided by
the compiler/linker for this purpose.

This pointer is consumed by `swift_addNewDSOImage()` and, later, by
Swift Testing when running tests, but is otherwise unused, so the less
work we do on it at runtime, the better.

A fallback path is present that, for images that do not contain
`__ehdr_start`, derives the address by calling `dladdr()` on the section
structure's address.

Resolves #84997.
2025-10-24 12:01:09 -07:00
Anthony Latsis
8e16bc0644 runtime: Silence a -Wglobal-constructors error than appears with upstream clang
Landing this on main to minimize rebranch-specific changes.
2025-06-02 17:20:57 +01:00
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
Alastair Houghton
7df249b67c [Runtime] Tidy up a couple of minor nits.
This doesn't change any code, just makes things look slightly
neater.

rdar://123504095
2024-04-29 10:48:23 +01:00
Alastair Houghton
554c402f11 [Runtime] Add the retain attribute to make the backtracer work.
Without `retain` here, we might remove the reference that pulls in
the backtracing support code.

rdar://123504095
2024-04-29 10:48:23 +01:00
Alastair Houghton
b7557247a7 [Runtime] Tidy up section declarations slightly.
This also calls out the reflection sections, even though we don't
actually need to do anything special for them (as it turns out).

rdar://123504095
2024-04-29 10:48:22 +01:00
Konrad `ktoso` Malawski
1d44e2e8e0 [Distributed] Undo new record and mangling scheme for dist.p.witnesses (#71801) 2024-02-22 23:02:29 +09:00
Yuta Saito
f3f13a2637 [wasm] Enable --gc-sections for WebAssembly by default
This change enables the `--gc-sections` linker flag for WebAssembly
targets by default. This flag has been disabled because it did not
respect `llvm.used` and it caused stripping `swift5` metadata sections
even though they were used through encapsulation symbols (a.k.a `__start`/`__stop`).

The issue has been fixed in the LLVM side (ba3c1f9ce3)
by adding new segment flags to the WebAssembly object file format.
2024-02-21 02:13:01 +00:00
Jonathan Grynspan
d35dcc8f9c Add swift5_tests to MetadataSections. (#71509) 2024-02-19 13:47:40 -05:00
Konrad `ktoso` Malawski
e9c7f3c382 [Distributed] Target identifiers for protocol calls (#70928) 2024-02-16 07:19:20 -08:00
Alastair Houghton
c9efa69ef1 [Linux] Make the backtracing symbol reference conditional.
On the LSan builds, we disable the backtracer, which results in a
link error because we completely remove the code from libswiftCore.

rdar://116105222
2023-09-27 09:56:22 +01:00
Alastair Houghton
598bce2404 [Linux] Force the inclusion of the backtracing code when static linking.
When we're statically linking the standard library, we need to force
the inclusion of the backtracing code in the runtime, otherwise we don't
get on-crash backtraces.

Also, add a test to make sure that this works.

rdar://115774613
2023-09-21 15:03:51 +01:00
Yuta Saito
8d84a64556 [wasm] Add metadata registration for WebAssembly
This patch adds the metadata registration for the wasm targets, and also
adds build support for it.
2023-06-19 06:13:20 +00:00