[AArch64] DW_TAG_label prevents elf from loading in Trace32 and other tools

David Blaikie dblaikie at gmail.com
Fri Aug 22 11:20:11 PDT 2014


On Fri, Aug 22, 2014 at 11:18 AM, Weiming Zhao <weimingz at codeaurora.org> wrote:
> Hi David,
>
> Thanks for your response.
> The tool complained that "Entry error near offset xxxx in file yyyy". That offset is in .debug_info, around a DIE about asm label.

I don't think that diagnostic is sufficient for me to guestimate what
might be the source of the problem, sorry.

>
> For C files, clang -g is ok.
> I just tried C files with labels and it's OK.
>
> We do suspect it's an issue of the tool.
>
> Thanks,
> Weiming
>
>
> -----Original Message-----
> From: David Blaikie [mailto:dblaikie at gmail.com]
> Sent: Friday, August 22, 2014 10:57 AM
> To: Ana Pazos
> Cc: Tim Northover; llvm-commits; weimingz at codeaurora.org
> Subject: Re: [AArch64] DW_TAG_label prevents elf from loading in Trace32 and other tools
>
> On Thu, Aug 21, 2014 at 6:44 PM, Ana Pazos <apazos at codeaurora.org> wrote:
>> Hi Tim,
>>
>>
>>
>> Trace32 and some other internal tools are not loading AArch64 LLVM
>> executables built with -g flag and the integrated assembler.
>>
>>
>>
>> The tools complain about the entry DW_TAG_label in debug_info section
>> emitted for assembly files (code in lib/MC/MCDwarf.cpp).
>
> You'd have to be more specific about what those complaints are.
>
> So far as I know (and I've looked at a fair bit of debug info - but not much of the asm debug info specifically) the DWARF we emit there is correct. I could imagine we might have an incorrect relocation for a label on a particular architecture or somesuch, but there's not much I can do to help diagnose that with the information you've provided.
>
>> Building the executables with LLVM with no-integrated-as flag works
>> because GAS does not emit this entry.
>
> Have you tried compiling a piece of C code with an explicit label, using GCC and throwing that at your tools? (clang/LLVM don't produce label debug info for non-asm source, but GCC does - so if it's something to do with the label debug info, that could show it)
>
> And/or do your tools work with clang -g output? If it's something generically related to relocations/addresses in debug info, I'd imagine it would show up with that just as well.
>
>>
>>
>>
>> At first I thought setting DW_AT_prototyped to 0 was the issue (it
>> seems it should be 1 for non-C code). I changed it, but it did not help.
>>
>>
>>
>> The only thing that worked was to not emit DW_TAG_label entries at all.
>>
>>
>>
>> Is this a tool issue or LLVM is not emitting the fields required by
>> DW_TAG_label correctly?
>>
>>
>>
>> Thanks for the help,
>>
>> Ana.
>>
>>
>>
>>
>>
>> Here is a reduced example:
>>
>>
>>
>>                 .text
>>
>>                 .file        "a.c"
>>
>>                 .globl     main
>>
>>                 .align     2
>>
>>                 .type     main, at function
>>
>> main:                                   // @main
>>
>> // BB#0:
>>
>>                 sub         sp, sp, #16             // =16
>>
>>                 movz     w8, #0
>>
>>                 str           w8, [sp, #12]
>>
>>                 str           w0, [sp, #8]
>>
>>                 str           x1, [sp]
>>
>>                 ldr           w0, [sp, #8]
>>
>>                 add        sp, sp, #16             // =16
>>
>>                 ret
>>
>> .Ltmp1:
>>
>>                 .size       main, .Ltmp1-main
>>
>>
>>
>>
>>
>>
>>
>> aarch64-linux-gnu-objdump -dwarf=info  a.exe
>>
>>
>>
>> a0.exe:     file format elf64-littleaarch64
>>
>>
>>
>> Contents of the .debug_info section:
>>
>>
>>
>>   Compilation Unit @ offset 0x0:
>>
>>    Length:        0xa8 (32-bit)
>>
>>    Version:       3
>>
>>    Abbrev Offset: 0x0
>>
>>    Pointer Size:  8
>>
>> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
>>
>>     <c>   DW_AT_stmt_list   : 0x0
>>
>>     <10>   DW_AT_low_pc      : 0x400568
>>
>>     <18>   DW_AT_high_pc     : 0x400588
>>
>>     <20>   DW_AT_name        : a.s
>>
>>     <24>   DW_AT_comp_dir    : xxx
>>
>>     <6f>   DW_AT_producer    : LLVM ARM
>>
>>     <90>   DW_AT_language    : 32769         (MIPS assembler)
>>
>> <1><92>: Abbrev Number: 2 (DW_TAG_label)
>>
>>     <93>   DW_AT_name        : main
>>
>>     <98>   DW_AT_decl_file   : 0x1
>>
>>     <9c>   DW_AT_decl_line   : 0x6
>>
>>     <a0>   DW_AT_low_pc      : 0x400568
>>
>>     <a8>   DW_AT_prototyped  : 0
>>
>> <2><a9>: Abbrev Number: 3 (DW_TAG_unspecified_parameters)
>>
>> <2><aa>: Abbrev Number: 0
>>
>> <1><ab>: Abbrev Number: 0
>>
>>
>>
>>
>>
>> For the executable generated by gcc:
>>
>>
>>
>> aarch64-linux-gnu-objdump -dwarf=info g.exe
>>
>>
>>
>> g.exe:     file format elf64-littleaarch64
>>
>>
>>
>> Contents of the .debug_info section:
>>
>>
>>
>>   Compilation Unit @ offset 0x0:
>>
>>    Length:        0x7b (32-bit)
>>
>>    Version:       2
>>
>>    Abbrev Offset: 0x0
>>
>>    Pointer Size:  8
>>
>> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
>>
>>     <c>   DW_AT_stmt_list   : 0x0
>>
>>     <10>   DW_AT_low_pc      : 0x400510
>>
>>     <18>   DW_AT_high_pc     : 0x400530
>>
>>     <20>   DW_AT_name        : a.s
>>
>>     <24>   DW_AT_comp_dir    : xxx
>>
>>     <6f>   DW_AT_producer    : GNU AS 2.24.0
>>
>>     <7d>   DW_AT_language    : 32769        (MIPS assembler)
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>




More information about the llvm-commits mailing list