libdyld: fixed symbol relocation

Note that in libdyld/src/lib.rs #117-118, image pointer is already added
to the symbol offset, so we do not need to add the pointer again
This commit is contained in:
pca006132 2021-09-25 11:30:45 +08:00 committed by Sebastien Bourdeauducq
parent 62a30bda9b
commit d765b83e36

View File

@ -123,7 +123,7 @@ pub fn relocate<R: Relocatable>(
if let Some(addr) = lib.lookup(sym_name) { if let Some(addr) = lib.lookup(sym_name) {
// First, try to resolve against itself. // First, try to resolve against itself.
trace!("looked up symbol {} in image", format_sym_name(sym_name)); trace!("looked up symbol {} in image", format_sym_name(sym_name));
value = lib.image.ptr() as u32 + addr; value = addr;
} else if let Some(addr) = resolve(sym_name) { } else if let Some(addr) = resolve(sym_name) {
// Second, call the user-provided function. // Second, call the user-provided function.
trace!("resolved symbol {:?}", format_sym_name(sym_name)); trace!("resolved symbol {:?}", format_sym_name(sym_name));