Skip to content

dl_iterate_phdr() and ELF friends only defined on Linux and Fuchsia. #1066

Open
@vext01

Description

@vext01

Hi,

I'm writing a library around the dl_iterate_phdr API, and want it to be portable.

I've noticed that dl_iterate_phdr, its types, and constants, are defined only on Linux and Fuchsia for now:

$ ag PT_NULL
src/fuchsia/mod.rs
2431:pub const PT_NULL: u32 = 0;

src/unix/notbsd/linux/mod.rs
1225:pub const PT_NULL: u32 = 0;
$ ag dl_iterate_phdr
src/fuchsia/mod.rs
3976:    pub fn dl_iterate_phdr(

src/unix/notbsd/linux/mod.rs
2045:    pub fn dl_iterate_phdr(   
$ ag Elf64_Half                       
src/fuchsia/mod.rs
50:pub type Elf64_Half = u16;
930:        pub dlpi_phnum: Elf64_Half,

src/unix/notbsd/linux/mod.rs
31:pub type Elf64_Half = u16;
472:        pub dlpi_phnum: Elf64_Half,

AFAIK, all of this stuff if present on the BSDs. The ELF stuff is a standard ABI (although different for 32/64-bit arches) that could be shared across all platforms, but some of the types for dl_iterate_phdr differ per-platform. For example, on OpenBSD dl_phdr_info contains more fields than on Linux.

For now users can work around this by using bindgen, but in the long run I think it would be best for libc to implement these interfaces across all platforms.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions