mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ELF is segment mapped, where the segment which contains a particular section may be mapped to an address which does not correspond to the address on disk. Since the reflection dumper does not use the loader to load the image into memory, we must manually account for any section offsets. Calculate this value when we query the mmap'ed image and wire it through to the relative direct pointer accesses. When switching to the linker table approach for the ELF metadata introspection, this was uncovered as the segment containing the orphaned sections was coalesced into a separate PT_LOAD header which had a non-0 offset for the mapping.