mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 14:57:56 +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:
@@ -215,8 +215,9 @@ impl PolkaVMWriteLLVM for FunctionDefinition {
|
||||
self.identifier.as_str(),
|
||||
function_type,
|
||||
self.result.len(),
|
||||
Some(inkwell::module::Linkage::Private),
|
||||
Some(inkwell::module::Linkage::External),
|
||||
Some((self.location.line, self.location.column)),
|
||||
true,
|
||||
)?;
|
||||
PolkaVMFunction::set_attributes(
|
||||
context.llvm(),
|
||||
@@ -235,6 +236,7 @@ impl PolkaVMWriteLLVM for FunctionDefinition {
|
||||
context.set_current_function(
|
||||
self.identifier.as_str(),
|
||||
Some((self.location.line, self.location.column)),
|
||||
true,
|
||||
)?;
|
||||
context.set_basic_block(context.current_function().borrow().entry_block());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user