mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 16:51:04 +00:00
6858cb9a61
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>
31 lines
835 B
Rust
31 lines
835 B
Rust
//! The LLVM module build.
|
|
|
|
use revive_common::BYTE_LENGTH_WORD;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
/// The LLVM module build.
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct Build {
|
|
/// The PolkaVM text assembly.
|
|
pub assembly_text: Option<String>,
|
|
/// The metadata hash.
|
|
pub metadata_hash: Option<[u8; BYTE_LENGTH_WORD]>,
|
|
/// The PolkaVM binary bytecode.
|
|
pub bytecode: Vec<u8>,
|
|
/// The PolkaVM bytecode hash. Unlinked builds don't have a hash yet.
|
|
pub bytecode_hash: Option<[u8; BYTE_LENGTH_WORD]>,
|
|
}
|
|
|
|
impl Build {
|
|
/// A shortcut constructor.
|
|
pub fn new(metadata_hash: Option<[u8; BYTE_LENGTH_WORD]>, bytecode: Vec<u8>) -> Self {
|
|
Self {
|
|
assembly_text: None,
|
|
metadata_hash,
|
|
bytecode,
|
|
bytecode_hash: None,
|
|
}
|
|
}
|
|
}
|