Opened 5 years ago
Last modified 2 years ago
#15743 closed bug
implement dl_iterate_phdr — at Version 6
Reported by: | X512 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta4 |
Component: | System/POSIX | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description (last modified by )
This is hrev53903.
dl_iterate_phdr
is required for Mesa graphics drivers.
Required declarations are already present at https://git.haiku-os.org/haiku/tree/headers/compatibility/bsd/sys/link_elf.h.
Change History (6)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
The dl_iterate_phdr() function allows an application to inquire at run time to find out which shared objects it has loaded.
I think you can rather easily implement this using Haiku's get_next_image_info
. Indeed, it sounds like a good candidate to put into libbsd.
Musl's implementation, for reference: https://github.com/rofl0r/musl/blob/master/src/ldso/dl_iterate_phdr.c
comment:3 by , 4 years ago
Also needed for LLVM libunwind. It is used to get unwind tables from ELF program header table (PT_GNU_EH_FRAME).
comment:4 by , 4 years ago
I think you can rather easily implement this using Haiku's get_next_image_info.
No, it can't. dl_iterate_phdr
allows go get image base and ELF program header table.
comment:5 by , 4 years ago
runtime_loader
currently don't save ELF header and program header table in image_t. image_t
should be changed or dl_iterate_phdr
implementation should read ELF file on each call.
Also image_t
have no meaningful image base. It use regions that can be loaded at arbitrary addresses, possibly in different order than described in program header table. So formula addr == info->dlpi_addr + info->dlpi_phdr[x].p_vaddr;
described in documentation may not work.
comment:6 by , 4 years ago
Description: | modified (diff) |
---|
But dl_iterate_phdr isn't part of the POSIX standard. If we do end up implementing this, We probably would need to place the implementation under src/libs/bsd rather than in libroot.