Allow wrapping in VDSO lookup

master
Alexandros Naskos 2020-03-02 11:44:21 +02:00
parent 00be934569
commit a48cd1cf58
1 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {
}) {
const this_ph = @intToPtr(*elf.Phdr, ph_addr);
switch (this_ph.p_type) {
elf.PT_LOAD => base = vdso_addr + this_ph.p_offset - this_ph.p_vaddr,
elf.PT_LOAD => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr,
elf.PT_DYNAMIC => maybe_dynv = @intToPtr([*]usize, vdso_addr + this_ph.p_offset),
else => {},
}
@ -40,7 +40,7 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {
{
var i: usize = 0;
while (dynv[i] != 0) : (i += 2) {
const p = base + dynv[i + 1];
const p = base +% dynv[i + 1];
switch (dynv[i]) {
elf.DT_STRTAB => maybe_strings = @intToPtr([*]u8, p),
elf.DT_SYMTAB => maybe_syms = @intToPtr([*]elf.Sym, p),
@ -71,7 +71,7 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {
if (!checkver(maybe_verdef.?, versym[i], vername, strings))
continue;
}
return base + syms[i].st_value;
return base +% syms[i].st_value;
}
return 0;