This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Something different with elf64-x86-64 format?


 Hello,

 I got the format of ELF64 from (at least):
http://www.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf
 I have generated an ELF64, and I have:

etienne@cygne:~/projet/gujin$ objdump -h hello64.elf

hello64.elf:     file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         00000029  0000000000110000  0000000000110000  00110000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .note.gnu.build-id 00000024  0000000000400120  0000000000400120  00200120  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .rodata       00000022  0000000000110040  0000000000110040  00110040  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .data         00000023  0000000000310080  0000000000310080  00110080  2**5
                  CONTENTS, ALLOC, LOAD, DATA
  4 .comment      0000002d  0000000000000000  0000000000000000  00200144  2**0
                  CONTENTS, READONLY
etienne@cygne:~/projet/gujin$ xxd hello64.elf | less
0000000: 7f45 4c46 0201 0100 0000 0000 0000 0000  .ELF............
0000010: 0200 3e00 0100 0000 0000 1100 0000 0000  ..>.............
0000020: 4000 0000 0000 0000 b001 2000 0000 0000  @......... .....
0000030: 0000 0000 4000 3800 0400 4000 0700 0600  ....@.8...@.....
0000040: 0100 0000 0500 0000 0000 0000 0000 0000  ................
0000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000060: 6200 1100 0000 0000 6200 1100 0000 0000  b.......b.......
0000070: 0000 2000 0000 0000 0100 0000 0600 0000  .. .............
0000080: 8000 1100 0000 0000 8000 3100 0000 0000  ..........1.....
0000090: 8000 3100 0000 0000 c400 0f00 0000 0000  ..1.............
00000a0: c400 0f00 0000 0000 0000 2000 0000 0000  .......... .....
00000b0: 0400 0000 0400 0000 2001 2000 0000 0000  ........ . .....
00000c0: 2001 4000 0000 0000 2001 4000 0000 0000   .@..... .@.....

I find the correct header at 0, and at offset 0x20 I see
e_phoff: "Program header offset" so I get the program header
at 0x40.
At 0x40, I have p_type "Type of segment" i.e. PT_LOAD,
at 0x44 I have p_flags "Segment attributes" 0x05 (RX),
but at 0x48 I should have a 64 bits number p_offset
 "Offset in file" and it is zero... unlike what objdump tells.

Is there different ELF64 formats? a problem with ia32 toolchain?
Maybe it is an obvious error of my part, then thanks to point
me to it...

objdump -v : GNU objdump (GNU Binutils for Debian) 2.19.1

 Regards,
 Etienne.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]