diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldChainedPtr.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldChainedPtr.java index 0b757a2251..595dd44d47 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldChainedPtr.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldChainedPtr.java @@ -22,7 +22,7 @@ import ghidra.program.model.reloc.Relocation.Status; import ghidra.program.model.reloc.RelocationResult; /** - * @see mach-o/fixup-chains.h + * @see mach-o/fixup-chains.h */ public class DyldChainedPtr { @@ -168,6 +168,18 @@ public class DyldChainedPtr { } } + public static boolean isRelative(DyldChainType ptrFormat) { + switch (ptrFormat) { + case DYLD_CHAINED_PTR_64_OFFSET: + case DYLD_CHAINED_PTR_ARM64E_KERNEL: + case DYLD_CHAINED_PTR_ARM64E_USERLAND: + case DYLD_CHAINED_PTR_ARM64E_USERLAND24: + return true; + default: + return false; + } + } + public static boolean isBound(DyldChainType ptrFormat, long chainValue) { switch (ptrFormat) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java index 24dac9bc6e..b2c8e33c72 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java @@ -480,6 +480,8 @@ public class MachoProgramBuilder { } protected boolean processExports(MachHeader header) throws Exception { + monitor.setMessage("Processing exports..."); + List exports = new ArrayList<>(); // Old way - export tree in DyldInfoCommand @@ -1794,7 +1796,9 @@ public class MachoProgramBuilder { } else { newChainValue = DyldChainedPtr.getTarget(pointerFormat, chainValue); - newChainValue += imageBaseOffset; + if (DyldChainedPtr.isRelative(pointerFormat)) { + newChainValue += imageBaseOffset; + } } if (!start || !program.getRelocationTable().hasRelocation(chainLoc)) {