public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* dwarf2 and objdump -S --adjust-vma
@ 2001-05-24 12:24 Karsten Keil
  2001-05-28  3:05 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Karsten Keil @ 2001-05-24 12:24 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-05-28  4:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-24 12:24 dwarf2 and objdump -S --adjust-vma Karsten Keil
2001-05-28  3:05 ` Nick Clifton
2001-05-28  4:55   ` Karsten Keil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).