fix compilation: insert procedures at front, ltvm: use 0 as default entrypoint
This commit is contained in:
parent
5c2a610d31
commit
6b577e91f8
4 changed files with 126 additions and 135 deletions
ltvm/src
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue