[Dwarf-Discuss] Section offset values
Mon Nov 8 16:16:46 GMT 2010
Dne 8.11.2010 12:43, Jakub Jelinek napsal(a):
> On Mon, Nov 08, 2010 at 12:30:19PM +0100, Jakub K?oustek wrote:
>> On 27.10.2010 15:21, Jakub Kroustek wrote:
>>> On 25.10.2010 19:12, David Anderson <davea42 at earthlink.net> wrote:
>>>> Check the .rel or .rela section!
>>>> When linking is later done the relocation
>>>> (which the compiler also creates) will have the right effect.
>>> Thanks for hint. In .rela.debug_pubnames section, I see:
>>> Offset Info Type Sym. Value Sym. Name + Addend
>>> 000000000006 00060000000a R_X86_64_32 0000000000000000 .debug_info + 0
>>> That is clear for me, the assembler used a R_X86_64_32 relocation type.
>>> But .rel / .rela sections are generated by assembler not by C compiler
>>> (gcc -g3 -S test.c), so I still don't know why the assembler used
>>> relocation (and this type of relocation) for directive ".long
>>> .Ldebug_info0" in section .debug_pubnames. This is not the default
>>> behavior of ".long label" directive translation.
>> Sorry for reopening, but no one can help with this topic?
> I don't understand why do you care.
> GCC knows these are offsets to .debug_* sections, i.e. non-allocated
> and thus rely on the start of each such section to have address 0,
> which is generally true in ELF. It is not true in PE-COFF, which is
> why GCC uses different relocations there.
Oh, the .debug_* sections are mapped to address 0 in ELF. So the
assembler translates those directives as usual, but the section address
is 0. I was missing this information. It's clear to me now, thank you
for your help.
For your information: I use GCC C complier only for generation of the
asm code which will be latter translated by our own assembler (i.e. not
the GNU assembler). Therefore, I need to know how to correctly translate
More information about the Dwarf-discuss