swift-testing
swift-testing copied to clipboard
Stop calling runtime-internal function to enumerate tests on ELF platforms
Currently, on ELF only, we need to call an internal runtime function swift_enumerateAllMetadataSections() in order to find sections that contain our metadata. That's because ELF binaries generally don't preserve section header information. I'd love for our platform-specific implementation to look like:
template <typename SectionEnumerator>
static void enumerateTypeMetadataSections(const SectionEnumerator& body) {
dl_iterate_phdr([] (struct dl_phdr_info *info, size_t size, void *context) -> int {
const SectionEnumerator& body = *reinterpret_cast<SectionEnumerator *>(context);
bool stop = false;
if (auto sb = /* ??? */(info)) {
body(sb, &stop);
}
return stop;
}, const_cast<SectionEnumerator *>(&body));
}
Potentially addressed by https://github.com/swiftlang/swift/issues/76698.
Tracked internally as rdar://136789701.
Should be possible to resolve this once https://github.com/swiftlang/swift/pull/78411 lands.