fix symbol functions

master
Ales Katona 4 years ago
parent 16255e6036
commit 056e7f8426
Signed by: almindor
GPG Key ID: 2F773149BF38B48F

@ -50,7 +50,13 @@ impl Symbols {
R: Relocatable, R: Relocatable,
{ {
self.value_index.map_or(Ok(&[]), |v| { self.value_index.map_or(Ok(&[]), |v| {
object.symbol_value(self.indexes[v].symbol_index) let si = self.indexes[v];
// can this be compile time checked??
if si.object_index != object.object_index() {
Err(Error::InvalidObjectIndex)
} else {
object.symbol_value(si.symbol_index)
}
}) })
} }

@ -224,7 +224,7 @@ impl Relocatable for ElfObject {
.ok_or(Error::InvalidSectionIndex)?; .ok_or(Error::InvalidSectionIndex)?;
let sh_offset: usize = shdr.sh_offset as usize; let sh_offset: usize = shdr.sh_offset as usize;
Ok(sh_offset) Ok(sh_offset + s64.st_value as usize)
} }
fn symbol_needs_resolving(&self, index: usize) -> bool { fn symbol_needs_resolving(&self, index: usize) -> bool {

Loading…
Cancel
Save