bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hex dump in objdump and readelf


From: Santiago Urueña Pascual
Subject: Hex dump in objdump and readelf
Date: Mon, 25 Jun 2007 16:24:51 +0200

Hello, I have noticed that hexadecimal dumps in objdump and readelf
are different: the bytes in each line are shown in inverse order, but
the ASCII representation is the same. Is this intended?

$
$ readelf --version
GNU readelf 2.17 Debian GNU/Linux
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
$
$ readelf -x .text null.o

Hex dump of section '.text':
 0x00000000 ec8351e5 8955fc71 fff0e483 04244c8d .L$.....q.U..Q..
 0x00000010 c7000000 00ec45c7 00000000 e845c734 4.E......E......
 0x00000020 f845c700 000000f4 45c70000 0000f045 E......E......E.
 0x00000030 00002404 c7042444 89e8458b 00000000 .....E..D$...$..
 0x00000040 04c70424 4489ec45 8bffffff fce80000 ........E..D$...
 0x00000050 244489f0 458bffff fffce800 00000c24 $..........E..D$
 0x00000060 f4458bff fffffce8 00000018 2404c704 ...$..........E.
 0x00000070 fffffffc e8000000 242404c7 04244489 .D$...$$........
 0x00000080 fce80000 00302404 c7042444 89f8458b .E..D$...$0.....
 0x00000090   ffffff fce80000 00012404 c7ffffff .....$.........
$
$
$ objdump -s -j .text null.o

null.o:     file format elf32-i386

Contents of section .text:
0000 8d4c2404 83e4f0ff 71fc5589 e55183ec  .L$.....q.U..Q..
0010 34c745e8 00000000 c745ec00 000000c7  4.E......E......
0020 45f00000 0000c745 f4000000 00c745f8  E......E......E.
0030 00000000 8b45e889 442404c7 04240000  .....E..D$...$..
0040 0000e8fc ffffff8b 45ec8944 2404c704  ........E..D$...
0050 240c0000 00e8fcff ffff8b45 f0894424  $..........E..D$
0060 04c70424 18000000 e8fcffff ff8b45f4  ...$..........E.
0070 89442404 c7042424 000000e8 fcffffff  .D$...$$........
0080 8b45f889 442404c7 04243000 0000e8fc  .E..D$...$0.....
0090 ffffffc7 04240100 0000e8fc ffffff    .....$.........
$

Using an hexadecimal editor I obtain the same output than objdump. Of
course, if the section is disassembled with objdump the output is
reversed from readelf's results:

$ objdump -d -j .text null.o

null.o:     file format elf32-i386

Disassembly of section .text:

00000000 <main>:
  0:   8d 4c 24 04             lea    0x4(%esp),%ecx
  4:   83 e4 f0                and    $0xfffffff0,%esp
  7:   ff 71 fc                pushl  0xfffffffc(%ecx)
  a:   55                      push   %ebp
  b:   89 e5                   mov    %esp,%ebp
  d:   51                      push   %ecx
  e:   83 ec 34                sub    $0x34,%esp
 11:   c7 45 e8 00 00 00 00    movl   $0x0,0xffffffe8(%ebp)
 18:   c7 45 ec 00 00 00 00    movl   $0x0,0xffffffec(%ebp)
 1f:   c7 45 f0 00 00 00 00    movl   $0x0,0xfffffff0(%ebp)
 26:   c7 45 f4 00 00 00 00    movl   $0x0,0xfffffff4(%ebp)
 2d:   c7 45 f8 00 00 00 00    movl   $0x0,0xfffffff8(%ebp)
 34:   8b 45 e8                mov    0xffffffe8(%ebp),%eax
 37:   89 44 24 04             mov    %eax,0x4(%esp)
 3b:   c7 04 24 00 00 00 00    movl   $0x0,(%esp)
 42:   e8 fc ff ff ff          call   43 <main+0x43>
 47:   8b 45 ec                mov    0xffffffec(%ebp),%eax
 4a:   89 44 24 04             mov    %eax,0x4(%esp)
 4e:   c7 04 24 0c 00 00 00    movl   $0xc,(%esp)
 55:   e8 fc ff ff ff          call   56 <main+0x56>
 5a:   8b 45 f0                mov    0xfffffff0(%ebp),%eax
 5d:   89 44 24 04             mov    %eax,0x4(%esp)
 61:   c7 04 24 18 00 00 00    movl   $0x18,(%esp)
 68:   e8 fc ff ff ff          call   69 <main+0x69>
 6d:   8b 45 f4                mov    0xfffffff4(%ebp),%eax
 70:   89 44 24 04             mov    %eax,0x4(%esp)
 74:   c7 04 24 24 00 00 00    movl   $0x24,(%esp)
 7b:   e8 fc ff ff ff          call   7c <main+0x7c>
 80:   8b 45 f8                mov    0xfffffff8(%ebp),%eax
 83:   89 44 24 04             mov    %eax,0x4(%esp)
 87:   c7 04 24 30 00 00 00    movl   $0x30,(%esp)
 8e:   e8 fc ff ff ff          call   8f <main+0x8f>
 93:   c7 04 24 01 00 00 00    movl   $0x1,(%esp)
 9a:   e8 fc ff ff ff          call   9b <main+0x9b>
$

Best regards,

--
Santiago Urueña Pascual <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]