use formatic::{Arch, BinFormat, Decl, Endian, Link, ObjectBuilder, Scope};
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut obj = ObjectBuilder::new("test.o");
obj.decls(vec![
("callme", Decl::Function(Scope::Import)),
("call", Decl::Function(Scope::Export)),
("data", Decl::Data(Scope::Export)),
]);
obj.define(
"call",
vec![
0xF3, 0x0F, 0x1E, 0xFA, 0x55, 0x48, 0x89, 0xE5, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0xC3, ],
);
obj.define("data",
b"Hello World".into()
);
obj.link(Link {
from: "call".into(),
to: "callme".into(),
at: 9,
});
obj.write(BinFormat::host(), Arch::host(), Endian::host())?;
Ok(())
}