Initial reorg.
This is largely the same as #305, but updated for the current tree.
This commit is contained in:
20
crates/obj/src/table.rs
Normal file
20
crates/obj/src/table.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user