Commit Graph

19 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
Konrad `ktoso` Malawski
1d44e2e8e0 [Distributed] Undo new record and mangling scheme for dist.p.witnesses (#71801) 2024-02-22 23:02:29 +09:00
Konrad `ktoso` Malawski
e9c7f3c382 [Distributed] Target identifiers for protocol calls (#70928) 2024-02-16 07:19:20 -08:00
Jonathan Grynspan
b2bbf00bd7 Remove unused infrastructure added for runtime attributes (#62971) 2023-01-12 04:16:45 -08:00
Jonathan Grynspan
8af9b14428 Only touch the MetadataSections::swift5_runtime_attributes field in newer structures 2022-12-20 09:45:01 -08:00
Jonathan Grynspan
11033c6aa4 Fill out dynamic loading of the runtime attributes section 2022-12-20 09:45:01 -08:00
Jonathan Grynspan
70d4b4678e Add swift:: in a couple of places that don't have using namespace swift (affects sourcekit-lsp) (#62583) 2022-12-14 16:34:44 -05:00
Jonathan Grynspan
c889270a38 Remove lookupSymbol() and have all callers use SymbolInfo::lookup() instead (#62552) 2022-12-14 08:33:32 -05:00
Jonathan Grynspan
26fc627ad0 Fix a use-after-free bug on Win32 when calling lookupSymbol() (#62484) 2022-12-13 09:04:34 -05: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
Jonathan Grynspan
845182252c Add exported symbol on non-Apple platforms to enumerate MetadataSection structures at runtime. 2022-03-04 23:44:10 -05: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
Pavel Yaskevich
3f4c06eb1b [Distributed] Runtime: Add skeleton support for accessible function sections 2021-12-17 10:52:56 -08:00
Alejandro Alonso
7e0eaf7b99 Remove metadata section functions from the stdlib (#39236)
add aliases in test suite
2021-09-14 11:55:39 -07:00
Mike Ash
6aab257c33 [Concurrency] Add compatibility overrides to Concurrency library.
Take the existing CompatibilityOverride mechanism and generalize it so it can be used in both the runtime and Concurrency libraries. The mechanism is preprocessor-heavy, so this requires some tricks. Use the SWIFT_TARGET_LIBRARY_NAME define to distinguish the libraries, and use a different .def file and mach-o section name accordingly.

We want the global/main executor functions to be a little more flexible. Instead of using the override mechanism, we expose function pointers that can be set by the compatibility library, or by any other code that wants to use a custom implementation.

rdar://73726764
2021-03-22 11:09:06 -04:00
Augusto Noronha
3cb8f9b6fc Add entrypoints to the runtime that exposes metadata necessary for reflection tests on Linux (#32339) 2020-07-24 15:26:15 -07:00
Augusto Noronha
5cee6f3d6a Unify 'MetadataSections' data structure, as well as common ELF and COFF procedures 2020-06-29 19:35:44 -03:00