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

David Blaikie dblaikie at gmail.com
Thu Aug 28 10:55:20 PDT 2014


Hey Kevin,

It looks like you originally implemented -g for asm by emitting a
subprogram for each non-local label and using DW_TAG_unspecified_parameters
to indicate that the signature was unknown. (r146262)

Later on (r147860) you changed these subprograms to be labels instead, but
the DW_TAG_unspecified_parameters remained.

DW_TAG_unspecified_parameters is only relevant to DW_TAG_subprograms - so
can we remove it now that these are labels instead? Or do you have some
need for it?

- David


On Thu, Aug 28, 2014 at 8:11 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
> On Aug 28, 2014 6:38 AM, "Keith Walker" <kwalker at arm.com> wrote:
> >
> > Ana,
> >
> > Did you get any further to the bottom of this issue?
> >
> > Although the DW_AT_prototyped attribute is not one specified in the DWARF
> > specification for use on the DW_TAG_label I would have hoped this would
> be
> > benign to the tools.
> >
> > One thing that looks "strange" to me is that the DW_TAG_label has a
> > DW_TAG_unspecified_parameters as a child.  My suspicion is that the
> tools do
> > not expect DW_TAG_label to have any children.  (The DWARF spec is silent
> is
> > this respect).
>
> Sorry I didn't notice that in the original dump but that does sound
> particularly bogus. I will see if I can reproduce it when I get to the
> office.
>
> >
> > Keith
> >
> > > -----Original Message-----
> > > From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> > > bounces at cs.uiuc.edu] On Behalf Of Ana Pazos
> > > Sent: 22 August 2014 22:04
> > > To: 'David Blaikie'; 'Weiming Zhao'
> > > Cc: 'llvm-commits'
> > > Subject: RE: [AArch64] DW_TAG_label prevents elf from loading in
> > > Trace32 and other tools
> > >
> > > Hi David,
> > >
> > > Unfortunately the tools do not print more details other than a generic
> > > error message.
> > >
> > > Are you able to load AArch64 executables built with -g on Trace32?
> > > Maybe you could try to reproduce the issue on your side?
> > >
> > > Thanks,
> > > Ana.
> > >
> > > -----Original Message-----
> > > From: David Blaikie [mailto:dblaikie at gmail.com]
> > > Sent: Friday, August 22, 2014 11:20 AM
> > > To: Weiming Zhao
> > > Cc: Ana Pazos; Tim Northover; llvm-commits
> > > Subject: Re: [AArch64] DW_TAG_label prevents elf from loading in
> > > Trace32 and other tools
> > >
> > > 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
> > > >>
> > > >
> > >
> > >
> > > _______________________________________________
> > > llvm-commits mailing list
> > > llvm-commits at cs.uiuc.edu
> > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140828/4bf3bd89/attachment.html>


More information about the llvm-commits mailing list