mirror of
https://github.com/cemu-project/GhidraRPXLoader.git
synced 2024-11-22 09:19:17 +01:00
Optimise relocations by using getUniqueExternalLocation
This commit is contained in:
parent
4603bdb986
commit
df0b8cd768
@ -56,18 +56,22 @@ public class Cafe_ElfRelocationHandler extends ElfRelocationHandler {
|
|||||||
elfRelocationContext.getSymbolAddress(sym), RefType.UNCONDITIONAL_CALL, SourceType.IMPORTED, 0);
|
elfRelocationContext.getSymbolAddress(sym), RefType.UNCONDITIONAL_CALL, SourceType.IMPORTED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalLocationIterator locations = program.getExternalManager()
|
String rplName = symbolSectionName.split("import_")[1];
|
||||||
.getExternalLocations(elfRelocationContext.getSymbolAddress(sym));
|
if (!rplName.endsWith(".rpl")) {
|
||||||
while (locations.hasNext()) {
|
rplName += ".rpl";
|
||||||
|
}
|
||||||
|
|
||||||
|
ExternalLocation location = program.getExternalManager().getUniqueExternalLocation(rplName, sym.getNameAsString());
|
||||||
|
if (location != null) {
|
||||||
try {
|
try {
|
||||||
ExternalLocation location = locations.next();
|
|
||||||
program.getReferenceManager().addExternalReference(relocationAddress, 1,
|
program.getReferenceManager().addExternalReference(relocationAddress, 1,
|
||||||
location, SourceType.IMPORTED, RefType.UNCONDITIONAL_CALL);
|
location, SourceType.IMPORTED, RefType.UNCONDITIONAL_CALL);
|
||||||
} catch (InvalidInputException e) {
|
} catch (InvalidInputException e) {
|
||||||
Msg.warn(this, "addExternalReference failed with " + e);
|
Msg.warn(this, "addExternalReference failed with " + e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Msg.warn(this, "Failed to find location for " + sym.getNameAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user