Commit 9d12f03a authored by Eduardo Souza's avatar Eduardo Souza

Try resolving unmangled symbols.

parent 42b66e19
......@@ -107,12 +107,29 @@ pub fn resolve_symbol(symbol: MuName) -> Address {
let rtld_default = unsafe { dlopen(ptr::null(), 0) };
let ret = unsafe { dlsym(rtld_default, c_symbol.as_ptr()) };
let error = unsafe { dlerror() };
if !error.is_null() {
return resolve_symbol_unmangled(symbol)
}
Address::from_ptr(ret)
}
pub fn resolve_symbol_unmangled(symbol: MuName) -> Address {
use std::ptr;
let c_symbol = CString::new((*symbol).clone()).unwrap();
let rtld_default = unsafe { dlopen(ptr::null(), 0) };
let ret = unsafe { dlsym(rtld_default, c_symbol.as_ptr()) };
let error = unsafe { dlerror() };
if !error.is_null() {
let cstr = unsafe { CStr::from_ptr(error) };
panic!(
"failed to resolve symbol: {} ({})",
"failed to resolve symbol(s): {} and {} ({})",
symbol,
mangle_name(symbol.clone()),
cstr.to_str().unwrap()
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment