mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
3.7 KiB
3.7 KiB