Commit Graph

2 Commits

Author SHA1 Message Date
vasilito a2f047712e link.h: add glibc-compatible ElfW(type) macro
Portable ELF code (Mesa util/build_id.c, unwinders) uses ElfW(Nhdr) etc. and
expects <link.h> to define ElfW -> Elf64_type (LP64) / Elf32_type. Without it
those TUs fall back to an undefined Elf_##type and fail to compile.
2026-07-31 17:33:38 +03:00
vasilito 991d05ce2f ld_so: implement dl_iterate_phdr (link.h)
Mesa's Intel Anvil Vulkan driver requires dl_iterate_phdr, which relibc lacked
(meson cc.has_function fails). Implement it against the dynamic linker's
authoritative object list: store each object's program headers on the DSO
(new DSO.phdrs, populated in both from_raw and new), add Linker::iter_dsos, and
add a src/header/link module exporting dl_iterate_phdr that walks the loaded
objects and reports each one's base/name/phdr-table to the callback (stopping
early on non-zero return, per spec). Static binaries (no linker) report zero
objects. Hand-written include/link.h declares struct dl_phdr_info with a
correctly-typed const Elf64_Phdr* dlpi_phdr.
2026-07-31 09:55:43 +03:00