swift
6981effb - Statically emit ELF notes for Swift's metadata sections.

Commit
269 days ago
Statically emit ELF notes for Swift's metadata sections. ELF does not preserve section information like Mach-O and COFF do. This PR adds additional exported symbols on platforms that use ELF to help us find Swift's metadata sections at runtime. These symbols are emitted as [ELF notes](https://man7.org/linux/man-pages/man5/elf.5.html), which are a kind of optional metadata that can be iterated at runtime using the [`dl_iterate_phdr()`](https://man7.org/linux/man-pages/man3/dl_iterate_phdr.3.html) function. Although the ELF standard says that notes can be stripped without affecting a program's behavior, in practice they are used widely for similar purposes e.g. by GCC/ld and various OS vendors. A more permanent solution may involve teaching llvm and lld about some new section name or attribute that translates to a specific custom ELF program header in the `PT_LOUSER`–`PT_HIUSER` range, then emitting that information for all of Swift's standard sections as well as anything marked `@_section`. Resolves #76698.
Author
Parents
Loading