fix(ghidra): resolve secondary symbols at function entries (#1195)
* fix(ghidra): resolve secondary symbols at function entries * test(ghidra): derive interior bytes from decoded instructions
This commit is contained in:
@@ -7,6 +7,9 @@ binaries and Ghidra projects are never committed.
|
||||
It covers imports, an external `puts` function, linker thunks, source symbols,
|
||||
direct calls, a targetless callback call, two referenced strings, and a
|
||||
multi-block branch.
|
||||
- `entry-aliases.c` preserves secondary imported entry labels, a bare-hex
|
||||
alias, and an interior label. The native CLI/MCP lane verifies entry selection,
|
||||
annotation, interior-label rejection, and unchanged source bytes.
|
||||
- `cross-format.c` is freestanding so the verifier can produce AArch64 ELF,
|
||||
x86-64 PE, and x86-64 Mach-O targets from the same semantics. It preserves an
|
||||
exported entry, direct and indirect calls, a volatile string reference, and a
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// Keep secondary imported entry labels and a non-entry control in one function.
|
||||
#if defined(__APPLE__)
|
||||
#define REA_SYMBOL(name) "_" name
|
||||
#else
|
||||
#define REA_SYMBOL(name) name
|
||||
#endif
|
||||
|
||||
__attribute__((noinline, used)) int rea_alias_target(void) {
|
||||
__asm__ volatile(".globl " REA_SYMBOL("rea_interior") "\n"
|
||||
REA_SYMBOL("rea_interior") ":");
|
||||
return 17;
|
||||
}
|
||||
|
||||
__asm__(".globl " REA_SYMBOL("rea_entry_alias") "\n"
|
||||
".set " REA_SYMBOL("rea_entry_alias") ", " REA_SYMBOL("rea_alias_target") "\n"
|
||||
// A bare hexadecimal identifier must still resolve as an entry label.
|
||||
".globl dead\n.set dead, " REA_SYMBOL("rea_alias_target") "\n");
|
||||
|
||||
int main(void) { return rea_alias_target(); }
|
||||
Reference in New Issue
Block a user