Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/std/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3971,7 +3971,7 @@ pub const dl_phdr_info = switch (native_os) {
/// Module name.
name: ?[*:0]const u8,
/// Pointer to module's phdr.
phdr: [*]std.elf.Phdr,
phdr: [*]std.elf.ElfN.Phdr,
/// Number of entries in phdr.
phnum: u16,
/// Total number of loads.
Expand All @@ -3984,7 +3984,7 @@ pub const dl_phdr_info = switch (native_os) {
.illumos => extern struct {
addr: std.elf.Addr,
name: ?[*:0]const u8,
phdr: [*]std.elf.Phdr,
phdr: [*]std.elf.ElfN.Phdr,
phnum: std.elf.Half,
/// Incremented when a new object is mapped into the process.
adds: u64,
Expand All @@ -3995,7 +3995,7 @@ pub const dl_phdr_info = switch (native_os) {
.openbsd, .haiku, .dragonfly, .netbsd, .serenity => extern struct {
addr: usize,
name: ?[*:0]const u8,
phdr: [*]std.elf.Phdr,
phdr: [*]std.elf.ElfN.Phdr,
phnum: std.elf.Half,
},
else => void,
Expand Down
20 changes: 10 additions & 10 deletions lib/std/debug/SelfInfo/Elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,11 @@ const DlIterContext = struct {

// Populate `build_id` and `gnu_eh_frame`
for (info.phdr[0..info.phnum]) |phdr| {
switch (phdr.p_type) {
std.elf.PT_NOTE => {
switch (phdr.type) {
.NOTE => {
// Look for .note.gnu.build-id
const segment_ptr: [*]const u8 = @ptrFromInt(info.addr + phdr.p_vaddr);
var r: std.Io.Reader = .fixed(segment_ptr[0..phdr.p_memsz]);
const segment_ptr: [*]const u8 = @ptrFromInt(info.addr + phdr.vaddr);
var r: std.Io.Reader = .fixed(segment_ptr[0..phdr.memsz]);
const name_size = r.takeInt(u32, native_endian) catch continue;
const desc_size = r.takeInt(u32, native_endian) catch continue;
const note_type = r.takeInt(u32, native_endian) catch continue;
Expand All @@ -455,9 +455,9 @@ const DlIterContext = struct {
const desc = r.take(desc_size) catch continue;
build_id = desc;
},
std.elf.PT_GNU_EH_FRAME => {
const segment_ptr: [*]const u8 = @ptrFromInt(info.addr + phdr.p_vaddr);
gnu_eh_frame = segment_ptr[0..phdr.p_memsz];
std.elf.PT.GNU_EH_FRAME => {
const segment_ptr: [*]const u8 = @ptrFromInt(info.addr + phdr.vaddr);
gnu_eh_frame = segment_ptr[0..phdr.memsz];
},
else => {},
}
Expand All @@ -478,11 +478,11 @@ const DlIterContext = struct {
});

for (info.phdr[0..info.phnum]) |phdr| {
if (phdr.p_type != std.elf.PT_LOAD) continue;
if (phdr.type != .LOAD) continue;
try context.si.ranges.append(gpa, .{
// Overflowing addition handles VSDOs having p_vaddr = 0xffffffffff700000
.start = info.addr +% phdr.p_vaddr,
.len = phdr.p_memsz,
.start = info.addr +% phdr.vaddr,
.len = phdr.memsz,
.module_index = module_index,
});
}
Expand Down
3 changes: 1 addition & 2 deletions lib/std/dynamic_library.zig
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ pub fn get_DYNAMIC() ?[*]const elf.Dyn {
});
}

pub fn linkmap_iterator(phdrs: []const elf.Phdr) error{InvalidExe}!LinkMap.Iterator {
_ = phdrs;
pub fn linkmap_iterator() error{InvalidExe}!LinkMap.Iterator {
const _DYNAMIC = get_DYNAMIC() orelse {
// No PT_DYNAMIC means this is a statically-linked non-PIE program.
return .{ .current = null };
Expand Down
Loading