else throw new RuntimeException("Unknown addressing type for unresolved symbol " + relocations[i].toString());
String name = symbolEntry.getName();
name = stripSymbolName(name);
UnresolvedSymbol unresolvedSymbol = new UnresolvedSymbol(
this,
name,
(int)(getFilePointerFromRVA(relocations[i].getRVA() + csHead.VirtualAddress)),
mode
);
// If it's an external symbol, rely on the Program class to resolve it
if (symbolEntry.isExternal()) {
logger.debug(" -- Marking as external reference");
unresolvedSymbols.add(unresolvedSymbol);
} else {
// Otherwise, perform relocation now
logger.debug(" -- Relocating " + symbolEntry.getName());
AbsoluteAddress relocatedAddress = new AbsoluteAddress(
symbolEntry.getValue() + imageBase +
section_headers[symbolEntry.getSectionNumber() - 1].VirtualAddress
);
logger.debug(" New address: " + relocatedAddress);
unresolvedSymbol.resolve(relocatedAddress);
}
}
}
inBuf = null;