You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
use alloc::string::String;
|
|
|
|
use alloc::vec::Vec;
|
|
|
|
use faerie::{Artifact, Decl};
|
|
|
|
|
|
|
|
/// Declares data segment symbol
|
|
|
|
pub fn declare_table(obj: &mut Artifact, index: usize) -> Result<(), String> {
|
|
|
|
let name = format!("_table_{}", index);
|
|
|
|
obj.declare(name, Decl::data())
|
|
|
|
.map_err(|err| format!("{}", err))?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Emit segment data and initialization location
|
|
|
|
pub fn emit_table(obj: &mut Artifact, index: usize) -> Result<(), String> {
|
|
|
|
let name = format!("_table_{}", index);
|
|
|
|
// FIXME: We need to initialize table using function symbols
|
|
|
|
obj.define(name, Vec::new())
|
|
|
|
.map_err(|err| format!("{}", err))?;
|
|
|
|
Ok(())
|
|
|
|
}
|