Use a PLT reference for function relocations in data objects

This ensures that all functions can be replaced without having to
perform relocations again.
This commit is contained in:
bjorn3
2020-11-12 16:41:23 +01:00
parent 8a4749af51
commit bf9e5d9448

View File

@@ -188,14 +188,7 @@ impl SimpleJITModule {
match *name { match *name {
ir::ExternalName::User { .. } => { ir::ExternalName::User { .. } => {
let (name, linkage) = if ModuleDeclarations::is_function(name) { let (name, linkage) = if ModuleDeclarations::is_function(name) {
let func_id = FuncId::from_name(name); return self.get_plt_address(name);
match &self.compiled_functions[func_id] {
Some(compiled) => return compiled.ptr,
None => {
let decl = self.declarations.get_function_decl(func_id);
(&decl.name, decl.linkage)
}
}
} else { } else {
let data_id = DataId::from_name(name); let data_id = DataId::from_name(name);
match &self.compiled_data_objects[data_id] { match &self.compiled_data_objects[data_id] {