#24 Doesn't perform relocations on disassembly

open
nobody
None
5
2008-09-28
2008-09-28
Howard Chu
No

A couple problems:
ht doesn't perform any analysis on ELF object files, it only works on fully linked files.
it seems to fail to perform relocations when analyzing a shared library.

e.g., objdump incorrectly disassembles this piece of code, and ht fails in the same way:

0000018a <SmpModemAudioHandler>:
18a: 55 push %ebp
18b: 89 e5 mov %esp,%ebp
18d: 83 ec 18 sub $0x18,%esp
190: 89 5d f8 mov %ebx,-0x8(%ebp)
193: 89 75 fc mov %esi,-0x4(%ebp)
196: 8b 75 08 mov 0x8(%ebp),%esi
199: 8b 5d 0c mov 0xc(%ebp),%ebx
19c: 8b 45 10 mov 0x10(%ebp),%eax
19f: 89 44 24 08 mov %eax,0x8(%esp)
1a3: 89 5c 24 04 mov %ebx,0x4(%esp)
1a7: 89 34 24 mov %esi,(%esp)
1aa: e8 fc ff ff ff call 1ab <SmpModemAudioHandler+0x21>
1af: 8b 45 14 mov 0x14(%ebp),%eax
1b2: 89 44 24 08 mov %eax,0x8(%esp)
1b6: 89 5c 24 04 mov %ebx,0x4(%esp)
1ba: 89 34 24 mov %esi,(%esp)
1bd: e8 fc ff ff ff call 1be <SmpModemAudioHandler+0x34>
1c2: 8b 5d f8 mov -0x8(%ebp),%ebx
1c5: 8b 75 fc mov -0x4(%ebp),%esi
1c8: 89 ec mov %ebp,%esp
1ca: 5d pop %ebp
1cb: c3 ret

The two calls are to addresses that require relocation. I noticed that boomerang also failed to process .o files, but it was a 1-line patch to enable that, after which it produced this output:

// address: 0x18a
void SmpModemAudioHandler(__size32 param1, __size32 param2) {
__size32 eax; // r24
__size32 ebp; // r29
__size32 *esp_1; // r28{18}

esp_1 = SmpModemAudioWrite(param1, param2); /* Warning: also results in ebp */
eax = *(ebp + 20);
*(__size32*)(esp_1 + 8) = eax;
*(__size32*)(esp_1 + 4) = param2;
*(__size32*)esp_1 = param1;
SmpModemAudioRead(*(esp_1 + 4), *esp_1);
return;
}

Notice that it inserts the correct symbol names for the function calls.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks