n-o-o-n / idp_hexagon

Hexagon processor module for IDA Pro disassembler
GNU Lesser General Public License v3.0
97 stars 22 forks source link

Resolve external symbol names? #12

Closed tewilove closed 1 year ago

tewilove commented 1 year ago

A simple test.

[ming@PC test]$ cat test.c
extern int one();

int two() 
{
  return one() + 1;
}
[ming@PC test]$ /usr/bin/llvm-objdump -d test.o

test.o: file format elf32-hexagon

Disassembly of section .text:

00000000 <two>:
       0:   00 c0 9d a0 a09dc000 {  allocframe(#0) } 
       4:   00 c0 00 5a 5a00c000 {  call 0x4 } 
       8:   20 c0 00 b0 b000c020 {  r0 = add(r0,#1) } 
       c:   1e c0 1e 96 961ec01e {  dealloc_return } 
[ming@PC test]$ /usr/bin/llvm-objdump -x test.o

test.o: file format elf32-hexagon
architecture: hexagon
start address: 0x00000000

Program Header:

Dynamic Section:

Sections:
Idx Name            Size     VMA      Type
  0                 00000000 00000000 
  1 .strtab         00000052 00000000 
  2 .text           00000010 00000000 TEXT
  3 .rela.text      0000000c 00000000 
  4 .comment        00000016 00000000 
  5 .note.GNU-stack 00000000 00000000 
  6 .llvm_addrsig   00000001 00000000 
  7 .symtab         00000040 00000000 

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 test.c
00000000 g     F .text  00000010 two
00000000         *UND*  00000000 one

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE                     VALUE
00000004 R_HEX_B22_PCREL          one

It is displaying "call 0x4" in IDA disassembly, how can I make it "call one". I checked the source code but I don't know what to do. The arm/aarch64 target is fine.