mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-17 02:01:01 +00:00
mark internal functions linker private (#381)
Prevents unused functions in the emitted ELF object. Drive-by add a missing test case (which misses a relocation under `-Oz` when all internal functions are marked as private). --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -83,7 +83,19 @@ pub fn link(
|
||||
let bytecode_linked = ElfLinker::setup()?.link(bytecode, symbols.as_slice())?;
|
||||
polkavm_linker(&bytecode_linked, strip_binary)
|
||||
.map(|pvm| (pvm, ObjectFormat::PVM))
|
||||
.unwrap_or_else(|_| (bytecode.to_vec(), ObjectFormat::ELF))
|
||||
.unwrap_or_else(|error| {
|
||||
if !error
|
||||
.to_string()
|
||||
.lines()
|
||||
.map(|line| line.trim())
|
||||
.filter(|line| !line.is_empty())
|
||||
.all(|line| line.contains("found undefined symbol"))
|
||||
{
|
||||
panic!("ICE: linker: {error}");
|
||||
}
|
||||
|
||||
(bytecode.to_vec(), ObjectFormat::ELF)
|
||||
})
|
||||
}
|
||||
Err(error) => panic!("ICE: linker: {error}"),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user