mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-15 02:11:08 +00:00
Prevent frontend function confusion (#383)
Function symbols can clash as we compile multiple YUL `object` definition into the same `LLVM` module. - Disambiguate via unique function symbols based its location (runtime or deploy code). - Use `LinkOnceODR` linkage for compiler builtin helpers. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
//! The deploy code function.
|
||||
|
||||
use crate::polkavm::context::code_type::CodeType;
|
||||
use crate::polkavm::context::function::runtime;
|
||||
use crate::polkavm::context::Context;
|
||||
use crate::polkavm::WriteLLVM;
|
||||
@@ -38,16 +37,16 @@ where
|
||||
0,
|
||||
Some(inkwell::module::Linkage::Private),
|
||||
None,
|
||||
false,
|
||||
)?;
|
||||
|
||||
self.inner.declare(context)
|
||||
}
|
||||
|
||||
fn into_llvm(self, context: &mut Context) -> anyhow::Result<()> {
|
||||
context.set_current_function(runtime::FUNCTION_DEPLOY_CODE, None)?;
|
||||
context.set_current_function(runtime::FUNCTION_DEPLOY_CODE, None, false)?;
|
||||
|
||||
context.set_basic_block(context.current_function().borrow().entry_block());
|
||||
context.set_code_type(CodeType::Deploy);
|
||||
|
||||
self.inner.into_llvm(context)?;
|
||||
context.set_debug_location(0, 0, None)?;
|
||||
|
||||
Reference in New Issue
Block a user