linker: add link_relative()
This commit is contained in:
parent
949f354c22
commit
7efee58c4d
1 changed files with 14 additions and 0 deletions
|
@ -47,6 +47,20 @@ impl Linker {
|
||||||
Ok(bytecode)
|
Ok(bytecode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn link_relative(self, symbol: &String) -> Result<Vec<AssemblyWord>, LinkError> {
|
||||||
|
Ok(self.link_partial()?
|
||||||
|
.into_iter()
|
||||||
|
.map(|w| match w {
|
||||||
|
AssemblyWord::Symbol(LinkAddr::Absolute(addr)) =>
|
||||||
|
AssemblyWord::Symbol(LinkAddr::Relative {
|
||||||
|
symbol: symbol.clone(),
|
||||||
|
offset: addr
|
||||||
|
}),
|
||||||
|
w => w
|
||||||
|
})
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn link_total(self) -> Result<Vec<VM_Word>, LinkError> {
|
pub fn link_total(self) -> Result<Vec<VM_Word>, LinkError> {
|
||||||
self.link_partial()?
|
self.link_partial()?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Reference in a new issue