openbsd: make dl_phdr_info cross arches

introduce Addr and Half definition to std.elf, and use them for dl_phdr_info
This commit is contained in:
Sébastien Marie 2020-10-25 11:13:42 +00:00 committed by Andrew Kelley
parent 0088efc4b2
commit 2a0a11aa66
2 changed files with 12 additions and 2 deletions

View File

@ -937,6 +937,16 @@ pub const Verdaux = switch (@sizeOf(usize)) {
8 => Elf64_Verdaux,
else => @compileError("expected pointer size of 32 or 64"),
};
pub const Addr = switch (@sizeOf(usize)) {
4 => Elf32_Addr,
8 => Elf64_Addr,
else => @compileError("expected pointer size of 32 or 64"),
};
pub const Half = switch (@sizeOf(usize)) {
4 => Elf32_Half,
8 => Elf64_Half,
else => @compileError("expected pointer size of 32 or 64"),
};
/// Machine architectures
/// See current registered ELF machine architectures at:

View File

@ -33,10 +33,10 @@ pub const Kevent = extern struct {
};
pub const dl_phdr_info = extern struct {
dlpi_addr: usize,
dlpi_addr: std.elf.Addr,
dlpi_name: ?[*:0]const u8,
dlpi_phdr: [*]std.elf.Phdr,
dlpi_phnum: u16,
dlpi_phnum: std.elf.Half,
};
pub const Flock = extern struct {