This commit is contained in:
bjorn3
2020-11-12 18:58:40 +01:00
parent cdbbcf7e13
commit 03c0e7e678

View File

@@ -568,11 +568,14 @@ impl<'simple_jit_backend> Module for SimpleJITModule {
unsafe { unsafe {
std::ptr::write(self.function_got_entries[id].unwrap().as_ptr(), ptr); std::ptr::write(self.function_got_entries[id].unwrap().as_ptr(), ptr);
} }
self.compiled_functions[id].as_ref().unwrap().perform_relocations( self.compiled_functions[id]
|name| unreachable!("non GOT or PLT relocation in function {} to {}", id, name), .as_ref()
|name| self.get_got_address(name), .unwrap()
|name| self.get_plt_address(name), .perform_relocations(
); |name| unreachable!("non GOT or PLT relocation in function {} to {}", id, name),
|name| self.get_got_address(name),
|name| self.get_plt_address(name),
);
Ok(ModuleCompiledFunction { size: code_size }) Ok(ModuleCompiledFunction { size: code_size })
} }
@@ -618,11 +621,14 @@ impl<'simple_jit_backend> Module for SimpleJITModule {
unsafe { unsafe {
std::ptr::write(self.function_got_entries[id].unwrap().as_ptr(), ptr); std::ptr::write(self.function_got_entries[id].unwrap().as_ptr(), ptr);
} }
self.compiled_functions[id].as_ref().unwrap().perform_relocations( self.compiled_functions[id]
|name| unreachable!("non GOT or PLT relocation in function {} to {}", id, name), .as_ref()
|name| self.get_got_address(name), .unwrap()
|name| self.get_plt_address(name), .perform_relocations(
); |name| unreachable!("non GOT or PLT relocation in function {} to {}", id, name),
|name| self.get_got_address(name),
|name| self.get_plt_address(name),
);
Ok(ModuleCompiledFunction { size: total_size }) Ok(ModuleCompiledFunction { size: total_size })
} }