From f79f7db3a288f589e0da6f8461765980e0b738db Mon Sep 17 00:00:00 2001 From: occheung Date: Wed, 1 Jun 2022 12:33:40 +0800 Subject: [PATCH] dyld: handle rebind on symbols relocated by CALL_PLT --- artiq/firmware/libdyld/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/artiq/firmware/libdyld/lib.rs b/artiq/firmware/libdyld/lib.rs index 9ace28ed4..15bbe2548 100644 --- a/artiq/firmware/libdyld/lib.rs +++ b/artiq/firmware/libdyld/lib.rs @@ -179,6 +179,16 @@ impl<'a> Library<'a> { } } + R_RISCV_CALL_PLT => { + let sym = self.symtab.get(ELF32_R_SYM(rela.r_info) as usize) + .ok_or("symbol out of bounds of symbol table")?; + let sym_name = self.name_starting_at(sym.st_name as usize)?; + + if sym_name == name { + self.update_rela(rela, addr - (self.image_off + rela.r_offset))? + } + } + // No associated symbols for other relocation types. _ => () }