[LLVMdev] [cfe-dev] Debug information on multiple files

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Aug 26 01:56:56 PDT 2010

On 25 Aug 2010, at 23:11, Renato Golin wrote:

> As far as I understood, there is nothing wrong with the way clang
> deals with stmt_list. The encoding is correct (AFAIK) and the offsets
> are always zero in every object file, as there is only one line table
> and one debug_info.

Are you taking into account the relocation information? Use "objdump - 
Dr" on an the object file compiled by gcc -gdwarf-2, and you will see  
something like this (on x86-64):

0000000000000000 <.debug_info>:
    0:   aa                      stos   %al,%es:(%rdi)
    1:   00 00                   add    %al,(%rax)
    3:   00 02                   add    %al,(%rdx)
    5:   00 00                   add    %al,(%rax)
                         6: R_X86_64_32  .debug_abbrev
    7:   00 00                   add    %al,(%rax)
    9:   00 08                   add    %cl,(%rax)
    b:   01 00                   add    %eax,(%rax)
                         c: R_X86_64_32  .debug_line

Note the R_X86_64_32 relocations. At link time, these relocations will  
be replaced by the absolute address of the symbol/section they point  
to (limited to 32 bits), added to the value stored in the object file.

With Clang, these relocations will be missing and hence the linker  
will just copy the data.


More information about the llvm-dev mailing list