<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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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="color:#1F497D">Awesome, couldn't have a clearer example.  Can you file a bug for this?  Product: libraries, component: MC.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Feel free to have a run at it yourself, if you don't want to wait a couple months.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Brian Cain [mailto:bcain@codeaurora.org]
<br>
<b>Sent:</b> Friday, August 24, 2018 10:45 AM<br>
<b>To:</b> 'David Blaikie'; Robinson, Paul<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> RE: [llvm-dev] [assembler + debuginfo] interaction with .file directive and debuginfo<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gcc as of 8.1 still behaves the same as clang 6.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">$ cat file_.S <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">//.file 1 "file.S"<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">.file "file_other.S"<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">.text<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">f1:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">              nop<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">.size f1, .-f1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">$ /local/mnt/workspace/install/gcc-8.1/bin/gcc-8.1 -g -o out.o -c file_.S ; objdump -t out.o
<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">out.o:     file format elf64-x86-64<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">SYMBOL TABLE:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    df *ABS*              0000000000000000 file_other.S<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .text   0000000000000000 .text<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .data  0000000000000000 .data<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .bss    0000000000000000 .bss<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l       .text     0000000000000001 f1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .debug_info    0000000000000000 .debug_info<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .debug_abbrev             0000000000000000 .debug_abbrev<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .debug_line    0000000000000000 .debug_line<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    d  .debug_aranges           0000000000000000 .debug_aranges<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">$ /local/mnt/workspace/install/clang_nightly_2018_Jul27/bin/clang  -g -o out.o -c file_.S ; objdump -t out.o
<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">out.o:     file format elf64-x86-64<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">SYMBOL TABLE:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l    df *ABS*              0000000000000000 file_other.S<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">0000000000000000 l       .text     0000000000000001 f1<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Brian Cain <bcain@codeaurora.org> <br>
<b>Sent:</b> Friday, August 24, 2018 11:27 AM<br>
<b>To:</b> 'David Blaikie' <dblaikie@gmail.com>; 'paul.robinson@sony.com' <paul.robinson@sony.com><br>
<b>Cc:</b> 'llvm-dev@lists.llvm.org' <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> RE: [llvm-dev] [assembler + debuginfo] interaction with .file directive and debuginfo<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gcc as of 4.2.4 generates the debuginfo even with “.file” (as did clang 6.0.0).  I’ll check a modern gcc.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>>
<br>
<b>Sent:</b> Friday, August 24, 2018 11:10 AM<br>
<b>To:</b> <a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a><br>
<b>Cc:</b> <a href="mailto:bcain@codeaurora.org">bcain@codeaurora.org</a>; <a href="mailto:llvm-dev@lists.llvm.org">
llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] [assembler + debuginfo] interaction with .file directive and debuginfo<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">What does gcc do?<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Aug 24, 2018 at 9:05 AM via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">There are two forms of the .file directive.  One is simply</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">               .file "path"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">and the other is</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">               .file <file-number> [ "dir"] "path" [ …. other stuff ]</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">The latter is sometimes referred to as the "DWARF" form of the .file directive.  I don't know the history about the different forms. I have certainly
 messed with the latter form to accommodate the needs of DWARF v5.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">I think it's pretty certain that the DWARF form of .file means that the .s file was generated with debug info, and therefore the correct behavior of
 "clang –g foo.s" in that case is to ignore the –g and assume the assembler source has all the right stuff.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">If the older form of .file can mean nothing more than "emit a file symbol" and not imply that the assembler source file itself already contains debug
 info, then seeing that form should not cause the assembler to ignore –g.  But as I said, I don't know the history and I don't understand how the first form is generally used.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">I'm quite willing to believe I did not understand the (largely unstated) specification for the non-DWARF form of .file, and if others agree that it should
 not imply that debug info already exists, then reporting that as a bug is appropriate.  I can't say I'd be able to find time to try to *fix* it before October, as I'm already over-committed, but I'd anticipate getting to it around that time.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#1F497D">--paulr</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a name="m_1784710761661091587__MailEndCompose"><span style="color:#1F497D"> </span></a><o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
<a href="mailto:bcain@codeaurora.org" target="_blank">bcain@codeaurora.org</a> [mailto:<a href="mailto:bcain@codeaurora.org" target="_blank">bcain@codeaurora.org</a>]
<br>
<b>Sent:</b> Thursday, August 23, 2018 3:18 PM<br>
<b>To:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Cc:</b> Robinson, Paul<br>
<b>Subject:</b> [assembler + debuginfo] interaction with .file directive and debuginfo
</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">[ I discussed this briefly with Paul off list and he suggested it would be better here. ]<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Among the changes in 7.0.0 are some that were added to support DWARFv5’s .debug_line.  
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The presence of “.file” mutes debug info generated by the assembler as of r328208 – logic in AsmParser::enabledGenDwarfForAssembly().<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The comment there states: “If we haven't encountered any .file directives (which would imply that the assembler source was produced with debug info already) then emit one describing
 the assembler source file itself.”<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Does .file imply that the assembly source was already produced with debug info?  Perhaps not in all cases.  If you wanted to emit an ELF::STT_FILE into your object, for example,
 you might add ```.file "foo.s"```.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I think we should change this behavior to the previous – check for “-g” but ignore “.file” directives.   Or maybe there’s a compromise to be found among the different versions of
 “.file” with various args?  Thoughts?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">-Brian<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</body>
</html>