dwarf2 and objdump -S --adjust-vma
Karsten Keil
kkeil@suse.de
Thu May 24 12:24:00 GMT 2001
Hi,
while debuging some x86-64 kernel problem I found a bug in
dwarf and objdump -S --adjust-vma handling.
It's not x86-64 related, following simple testcase shows the bug even on
i386:
Famous c code :-) hello.c:
main() {
printf("hello world\n");
}
cc -gdwarf-2 -c -o hello.o hello.c
objdump -S --adjust-vma 0x0 hello.o works as expected:
hello.o: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 08 sub $0x8,%esp
main() {
printf("hello world\n");
6: 83 c4 f4 add $0xfffffff4,%esp
9: 68 00 00 00 00 push $0x0
e: e8 fc ff ff ff call f <main+0xf>
13: 83 c4 10 add $0x10,%esp
}
16: 89 ec mov %ebp,%esp
18: 5d pop %ebp
19: c3 ret
1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
But
objdump -S --adjust-vma 0x10 hello.o
shows the bug:
hello.o: file format elf32-i386
Disassembly of section .text:
00000010 <main>:
main() {
printf("hello world\n");
10: 55 push %ebp
11: 89 e5 mov %esp,%ebp
13: 83 ec 08 sub $0x8,%esp
}
16: 83 c4 f4 add $0xfffffff4,%esp
19: 68 00 00 00 00 push $0x0
1e: e8 fc ff ff ff call 1f <main+0xf>
23: 83 c4 10 add $0x10,%esp
26: 89 ec mov %ebp,%esp
28: 5d pop %ebp
29: c3 ret
2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
The source code inserts are shifted with --adjust-vma offset and are gone
away if offset are big.
Tested with binutils CVS two days ago.
--
Karsten Keil
SuSE Labs
ISDN development
More information about the Binutils
mailing list