<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks Keith and David,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Removing DW_AT_prototyped makes the code fail to load yet again, pointing to an offset at Abbrev Number: 3 (DW_TAG_unspecified_parameters).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I will try removing that parameter too.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ana.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> David Blaikie [mailto:dblaikie@gmail.com] <br><b>Sent:</b> Thursday, August 28, 2014 10:55 AM<br><b>To:</b> Keith Walker; Kevin Enderby<br><b>Cc:</b> llvm-commits@cs.uiuc.edu; Ana Pazos; Weiming Zhao<br><b>Subject:</b> Re: [AArch64] DW_TAG_label prevents elf from loading in Trace32 and other tools<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hey Kevin,<br><br>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)<br><br>Later on (r147860) you changed these subprograms to be labels instead, but the DW_TAG_unspecified_parameters remained.<br><br>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?<br><br>- David<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Thu, Aug 28, 2014 at 8:11 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><p><br>On Aug 28, 2014 6:38 AM, "Keith Walker" <<a href="mailto:kwalker@arm.com" target="_blank">kwalker@arm.com</a>> wrote:<br>><br>> Ana,<br>><br>> Did you get any further to the bottom of this issue?<br>><br>> Although the DW_AT_prototyped attribute is not one specified in the DWARF<br>> specification for use on the DW_TAG_label I would have hoped this would be<br>> benign to the tools.<br>><br>> One thing that looks "strange" to me is that the DW_TAG_label has a<br>> DW_TAG_unspecified_parameters as a child.  My suspicion is that the tools do<br>> not expect DW_TAG_label to have any children.  (The DWARF spec is silent is<br>> this respect).<o:p></o:p></p></div><p>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.<o:p></o:p></p><div><div><p>><br>> Keith<br>><br>> > -----Original Message-----<br>> > From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-" target="_blank">llvm-commits-</a><br>> > <a href="mailto:bounces@cs.uiuc.edu" target="_blank">bounces@cs.uiuc.edu</a>] On Behalf Of Ana Pazos<br>> > Sent: 22 August 2014 22:04<br>> > To: 'David Blaikie'; 'Weiming Zhao'<br>> > Cc: 'llvm-commits'<br>> > Subject: RE: [AArch64] DW_TAG_label prevents elf from loading in<br>> > Trace32 and other tools<br>> ><br>> > Hi David,<br>> ><br>> > Unfortunately the tools do not print more details other than a generic<br>> > error message.<br>> ><br>> > Are you able to load AArch64 executables built with -g on Trace32?<br>> > Maybe you could try to reproduce the issue on your side?<br>> ><br>> > Thanks,<br>> > Ana.<br>> ><br>> > -----Original Message-----<br>> > From: David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]<br>> > Sent: Friday, August 22, 2014 11:20 AM<br>> > To: Weiming Zhao<br>> > Cc: Ana Pazos; Tim Northover; llvm-commits<br>> > Subject: Re: [AArch64] DW_TAG_label prevents elf from loading in<br>> > Trace32 and other tools<br>> ><br>> > On Fri, Aug 22, 2014 at 11:18 AM, Weiming Zhao<br>> > <<a href="mailto:weimingz@codeaurora.org" target="_blank">weimingz@codeaurora.org</a>> wrote:<br>> > > Hi David,<br>> > ><br>> > > Thanks for your response.<br>> > > The tool complained that "Entry error near offset xxxx in file yyyy".<br>> > That offset is in .debug_info, around a DIE about asm label.<br>> ><br>> > I don't think that diagnostic is sufficient for me to guestimate what<br>> > might be the source of the problem, sorry.<br>> ><br>> > ><br>> > > For C files, clang -g is ok.<br>> > > I just tried C files with labels and it's OK.<br>> > ><br>> > > We do suspect it's an issue of the tool.<br>> > ><br>> > > Thanks,<br>> > > Weiming<br>> > ><br>> > ><br>> > > -----Original Message-----<br>> > > From: David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]<br>> > > Sent: Friday, August 22, 2014 10:57 AM<br>> > > To: Ana Pazos<br>> > > Cc: Tim Northover; llvm-commits; <a href="mailto:weimingz@codeaurora.org" target="_blank">weimingz@codeaurora.org</a><br>> > > Subject: Re: [AArch64] DW_TAG_label prevents elf from loading in<br>> > > Trace32 and other tools<br>> > ><br>> > > On Thu, Aug 21, 2014 at 6:44 PM, Ana Pazos <<a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a>><br>> > wrote:<br>> > >> Hi Tim,<br>> > >><br>> > >><br>> > >><br>> > >> Trace32 and some other internal tools are not loading AArch64 LLVM<br>> > >> executables built with -g flag and the integrated assembler.<br>> > >><br>> > >><br>> > >><br>> > >> The tools complain about the entry DW_TAG_label in debug_info<br>> > section<br>> > >> emitted for assembly files (code in lib/MC/MCDwarf.cpp).<br>> > ><br>> > > You'd have to be more specific about what those complaints are.<br>> > ><br>> > > So far as I know (and I've looked at a fair bit of debug info - but<br>> > not much of the asm debug info specifically) the DWARF we emit there is<br>> > correct. I could imagine we might have an incorrect relocation for a<br>> > label on a particular architecture or somesuch, but there's not much I<br>> > can do to help diagnose that with the information you've provided.<br>> > ><br>> > >> Building the executables with LLVM with no-integrated-as flag works<br>> > >> because GAS does not emit this entry.<br>> > ><br>> > > Have you tried compiling a piece of C code with an explicit label,<br>> > > using GCC and throwing that at your tools? (clang/LLVM don't produce<br>> > > label debug info for non-asm source, but GCC does - so if it's<br>> > > something to do with the label debug info, that could show it)<br>> > ><br>> > > And/or do your tools work with clang -g output? If it's something<br>> > generically related to relocations/addresses in debug info, I'd imagine<br>> > it would show up with that just as well.<br>> > ><br>> > >><br>> > >><br>> > >><br>> > >> At first I thought setting DW_AT_prototyped to 0 was the issue (it<br>> > >> seems it should be 1 for non-C code). I changed it, but it did not<br>> > help.<br>> > >><br>> > >><br>> > >><br>> > >> The only thing that worked was to not emit DW_TAG_label entries at<br>> > all.<br>> > >><br>> > >><br>> > >><br>> > >> Is this a tool issue or LLVM is not emitting the fields required by<br>> > >> DW_TAG_label correctly?<br>> > >><br>> > >><br>> > >><br>> > >> Thanks for the help,<br>> > >><br>> > >> Ana.<br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >> Here is a reduced example:<br>> > >><br>> > >><br>> > >><br>> > >>                 .text<br>> > >><br>> > >>                 .file        "a.c"<br>> > >><br>> > >>                 .globl     main<br>> > >><br>> > >>                 .align     2<br>> > >><br>> > >>                 .type     main,@function<br>> > >><br>> > >> main:                                   // @main<br>> > >><br>> > >> // BB#0:<br>> > >><br>> > >>                 sub         sp, sp, #16             // =16<br>> > >><br>> > >>                 movz     w8, #0<br>> > >><br>> > >>                 str           w8, [sp, #12]<br>> > >><br>> > >>                 str           w0, [sp, #8]<br>> > >><br>> > >>                 str           x1, [sp]<br>> > >><br>> > >>                 ldr           w0, [sp, #8]<br>> > >><br>> > >>                 add        sp, sp, #16             // =16<br>> > >><br>> > >>                 ret<br>> > >><br>> > >> .Ltmp1:<br>> > >><br>> > >>                 .size       main, .Ltmp1-main<br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >> aarch64-linux-gnu-objdump -dwarf=info  a.exe<br>> > >><br>> > >><br>> > >><br>> > >> a0.exe:     file format elf64-littleaarch64<br>> > >><br>> > >><br>> > >><br>> > >> Contents of the .debug_info section:<br>> > >><br>> > >><br>> > >><br>> > >>   Compilation Unit @ offset 0x0:<br>> > >><br>> > >>    Length:        0xa8 (32-bit)<br>> > >><br>> > >>    Version:       3<br>> > >><br>> > >>    Abbrev Offset: 0x0<br>> > >><br>> > >>    Pointer Size:  8<br>> > >><br>> > >> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)<br>> > >><br>> > >>     <c>   DW_AT_stmt_list   : 0x0<br>> > >><br>> > >>     <10>   DW_AT_low_pc      : 0x400568<br>> > >><br>> > >>     <18>   DW_AT_high_pc     : 0x400588<br>> > >><br>> > >>     <20>   DW_AT_name        : a.s<br>> > >><br>> > >>     <24>   DW_AT_comp_dir    : xxx<br>> > >><br>> > >>     <6f>   DW_AT_producer    : LLVM ARM<br>> > >><br>> > >>     <90>   DW_AT_language    : 32769         (MIPS assembler)<br>> > >><br>> > >> <1><92>: Abbrev Number: 2 (DW_TAG_label)<br>> > >><br>> > >>     <93>   DW_AT_name        : main<br>> > >><br>> > >>     <98>   DW_AT_decl_file   : 0x1<br>> > >><br>> > >>     <9c>   DW_AT_decl_line   : 0x6<br>> > >><br>> > >>     <a0>   DW_AT_low_pc      : 0x400568<br>> > >><br>> > >>     <a8>   DW_AT_prototyped  : 0<br>> > >><br>> > >> <2><a9>: Abbrev Number: 3 (DW_TAG_unspecified_parameters)<br>> > >><br>> > >> <2><aa>: Abbrev Number: 0<br>> > >><br>> > >> <1><ab>: Abbrev Number: 0<br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >> For the executable generated by gcc:<br>> > >><br>> > >><br>> > >><br>> > >> aarch64-linux-gnu-objdump -dwarf=info g.exe<br>> > >><br>> > >><br>> > >><br>> > >> g.exe:     file format elf64-littleaarch64<br>> > >><br>> > >><br>> > >><br>> > >> Contents of the .debug_info section:<br>> > >><br>> > >><br>> > >><br>> > >>   Compilation Unit @ offset 0x0:<br>> > >><br>> > >>    Length:        0x7b (32-bit)<br>> > >><br>> > >>    Version:       2<br>> > >><br>> > >>    Abbrev Offset: 0x0<br>> > >><br>> > >>    Pointer Size:  8<br>> > >><br>> > >> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)<br>> > >><br>> > >>     <c>   DW_AT_stmt_list   : 0x0<br>> > >><br>> > >>     <10>   DW_AT_low_pc      : 0x400510<br>> > >><br>> > >>     <18>   DW_AT_high_pc     : 0x400530<br>> > >><br>> > >>     <20>   DW_AT_name        : a.s<br>> > >><br>> > >>     <24>   DW_AT_comp_dir    : xxx<br>> > >><br>> > >>     <6f>   DW_AT_producer    : GNU AS 2.24.0<br>> > >><br>> > >>     <7d>   DW_AT_language    : 32769        (MIPS assembler)<br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >><br>> > >> _______________________________________________<br>> > >> llvm-commits mailing list<br>> > >> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>> > >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>> > >><br>> > ><br>> ><br>> ><br>> > _______________________________________________<br>> > llvm-commits mailing list<br>> > <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>><br>><br>><br>><o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>