I'm a bit confused about the executable offset in ELF files. Do you know what the difference between an address and an offset is in this context? It seems obvious but if you look at the 2 sections I bolded, sometimes the offset is something like : 00400164 000164 which is obviously just the offset in memory starting from 400000. Other times the offset doesn't match the address offset : 1000018c 010190. And sometimes the address and offset match with an additional offset of 0x10000 : 10000000 010000. Is there something I'm missing having to do with dynamic linking? How does this segment linking work exactly?


EDIT: Okay, so, I did a hex dump of the executable file and I now realize that the offset is referring to the location in the actual elf file (contains elements at "addresses" 0 - 11d48.) So my question now is... how do I resolve the fact that many of the memory addresses reference address 0x00000000? They have different offsets of course but now that I know that is file specific, it means that several section alias. Do I actually use the offsets in memory addressing?

All of these segments alias now:

[25] .comment          PROGBITS        00000000 010190 00007e 00      0   0  1
  [26] .debug_aranges    MIPS_DWARF      00000000 010210 000058 00      0   0  8
  [27] .debug_info       MIPS_DWARF      00000000 010268 000146 00      0   0  1
  [28] .debug_abbrev     MIPS_DWARF      00000000 0103ae 000020 00      0   0  1
  [29] .debug_line       MIPS_DWARF      00000000 0103ce 0001a6 00      0   0  1
  [30] .pdr              PROGBITS        00000000 010574 000100 00      0   0  4
  [31] .mdebug.abi32     PROGBITS        00000000 010674 000000 00      0   0  1
[Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        00400134 000134 00000d 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            00400144 000144 000020 00   A  0   0  4
[B]  [ 3] .reginfo          MIPS_REGINFO    00400164 000164 000018 18   A  0   0  4[/B]
  [ 4] .dynamic          DYNAMIC         0040017c 00017c 000108 08   A  7   0  4
                            ...
  [15] .eh_frame_hdr     PROGBITS        004011b0 0011b0 000034 00   A  0   0  4
[B]  [16] .data             PROGBITS        10000000 010000 000030 00  WA  0   0 16[/B]
  [17] .rld_map          PROGBITS        10000030 010030 000004 00  WA  0   0  4
                            ...
  [22] .got              PROGBITS        10000110 010110 00007c 04 WAp  0   0 16
[B]  [23] .sbss             NOBITS          1000018c 010190 000000 00 WAp  0   0  1[/B]
  [24] .bss              NOBITS          10000190 010190 000020 00  WA  0   0 16
                            ...

Recommended Answers

All 2 Replies

Thanks for the refs. I think I've narrowed my problem down to the fact that my executable is using a dynamic loader. I need to make the executable completely stand alone before I can even think about running the file in my simulator. Basically all I can do in terms of an OS is load memory and syscalls...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.