* Make more code work with no_std. no_std support is still incomplete, but this patch takes care of the bulk of the straightforward parts.
21 lines
656 B
Rust
21 lines
656 B
Rust
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(())
|
|
}
|