Don't create functions for imports, we still call those indirectly.

This commit is contained in:
Nick Lewycky
2019-11-08 14:44:59 -08:00
parent 2957b6abd8
commit ed6ce4b9b4

View File

@ -8228,12 +8228,14 @@ impl ModuleCodeGenerator<LLVMFunctionCodeGenerator, LLVMBackend, CodegenError>
assoc: Map<FuncIndex, SigIndex>, assoc: Map<FuncIndex, SigIndex>,
) -> Result<(), CodegenError> { ) -> Result<(), CodegenError> {
for (index, sig_id) in &assoc { for (index, sig_id) in &assoc {
let function = self.module.borrow_mut().add_function( if index.index() >= self.func_import_count {
&format!("fn{}", index.index()), let function = self.module.borrow_mut().add_function(
self.signatures[*sig_id], &format!("fn{}", index.index()),
Some(Linkage::External), self.signatures[*sig_id],
); Some(Linkage::External),
self.llvm_functions.borrow_mut().insert(index, function); );
self.llvm_functions.borrow_mut().insert(index, function);
}
} }
self.function_signatures = Some(Arc::new(assoc)); self.function_signatures = Some(Arc::new(assoc));
Ok(()) Ok(())