fix compilation: insert procedures at front, ltvm: use 0 as default entrypoint

This commit is contained in:
Michael Sippel 2024-10-18 21:22:56 +02:00
parent 5c2a610d31
commit 6b577e91f8
Signed by: senvas
GPG key ID: F96CF119C34B64A6
4 changed files with 126 additions and 135 deletions
ltvm/src

View file

@ -32,13 +32,21 @@ fn main() {
std::fs::File::open(source_path).expect("Failed to open file")
);
linker.import( source_path, bincode::deserialize_from( input ).expect("") );
let obj_file : tisc::linker::ObjectFile = bincode::deserialize_from( input ).expect("");
for (name, addr) in obj_file.symbols.iter() {
symbols.insert(
name.clone(),
tisc::LinkAddr::Relative{
symbol: source_path.clone(),
offset: *addr
}
);
}
linker.import( source_path, obj_file );
}
let entry_addr = linker.get_link_addr(&args.entry).unwrap_or(0);
/*
.expect(&format!("cant find entry symbol '{}'", args.entry));
*/
let bytecode = linker.link_total().expect("Link error:");
eprintln!("{} ({} bytes)", "Loaded bytecode.".green(), bytecode.len());