<div dir="ltr">On Thu, Jul 17, 2014 at 11:05 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Thu, Jul 17, 2014 at 9:27 AM, Saleem Abdulrasool<br>
<<a href="mailto:compnerd@compnerd.org">compnerd@compnerd.org</a>> wrote:<br>
> Author: compnerd<br>
> Date: Thu Jul 17 11:27:44 2014<br>
> New Revision: 213275<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=213275&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=213275&view=rev</a><br>
> Log:<br>
> MC: correct DWARF header for PE/COFF assembly input<br>
><br>
> The header contains an offset to the DWARF abbreviations for the CU. Â The offset<br>
> must be section relative for COFF and absolute for others. Â The non-assembly<br>
> code path for the DWARF header generation already had the correct emission for<br>
> the headers. Â This corrects just the assembly path. Â Due to the invalid<br>
> relocation, processing of the debug information would halt previously on the<br>
> first assembly input as the associated abbreviations would be out of range as<br>
> they would have the location increased by image base and the section offset.<br>
><br>
> This address PR20332.<br>
><br>
> Added:<br>
> Â Â llvm/trunk/test/DebugInfo/X86/dbg-asm.s<br>
> Modified:<br>
> Â Â llvm/trunk/lib/MC/MCDwarf.cpp<br>
><br>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=213275&r1=213274&r2=213275&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=213275&r1=213274&r2=213275&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Thu Jul 17 11:27:44 2014<br>
> @@ -657,11 +657,12 @@ static void EmitGenDwarfInfo(MCStreamer<br>
><br>
> Â Â // The 4 byte offset to the debug abbrevs from the start of the .debug_abbrev,<br>
> Â Â // it is at the start of that section so this is zero.<br>
> - Â if (AbbrevSectionSymbol) {<br>
> - Â Â MCOS->EmitSymbolValue(AbbrevSectionSymbol, 4);<br>
> - Â } else {<br>
> + Â if (AbbrevSectionSymbol == nullptr)<br>
> Â Â Â MCOS->EmitIntValue(0, 4);<br>
> - Â }<br>
> + Â else if (context.getAsmInfo()->needsDwarfSectionOffsetDirective())<br>
> + Â Â MCOS->EmitCOFFSecRel32(AbbrevSectionSymbol);<br>
> + Â else<br>
> + Â Â MCOS->EmitSymbolValue(AbbrevSectionSymbol, 4);<br>
><br>
<br>
</div></div>Having the explicit COFF call in here is a bit weird. Can you abstract<br>
this out a bit?<br></blockquote><div><br></div><div>As discussed offline, this is indeed less than ideal. Â Addressed in SVN r213463. Â Sorry about the delay.</div><div>Â </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Thanks!<br>
<span class=""><font color="#888888"><br>
-eric<br>
</font></span><div class=""><div class="h5"><br>
> Â Â const MCAsmInfo *asmInfo = context.getAsmInfo();<br>
> Â Â int AddrSize = asmInfo->getPointerSize();<br>
><br>
> Added: llvm/trunk/test/DebugInfo/X86/dbg-asm.s<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-asm.s?rev=213275&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-asm.s?rev=213275&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/X86/dbg-asm.s (added)<br>
> +++ llvm/trunk/test/DebugInfo/X86/dbg-asm.s Thu Jul 17 11:27:44 2014<br>
> @@ -0,0 +1,22 @@<br>
> +# RUN: llvm-mc -triple i686-windows-gnu -g %s -filetype obj -o - \<br>
> +# RUN: Â | llvm-readobj -r - | FileCheck -check-prefix CHECK-COFF %s<br>
> +# RUN: llvm-mc -triple i686-windows-itanium -g %s -filetype obj -o - \<br>
> +# RUN: Â | llvm-readobj -r - | FileCheck -check-prefix CHECK-COFF %s<br>
> +# RUN: llvm-mc -triple i686-linux-gnu -g %s -filetype obj -o - \<br>
> +# RUN: Â | llvm-readobj -r - | FileCheck -check-prefix CHECK-ELF %s<br>
> +<br>
> +_a:<br>
> + Â Â Â movl $65, %eax<br>
> + Â Â Â ret<br>
> +<br>
> +# CHECK-COFF: Relocations [<br>
> +# CHECK-COFF: Â Section {{.*}} .debug_info {<br>
> +# CHECK-COFF: Â Â 0x6 IMAGE_REL_I386_SECREL .debug_abbrev<br>
> +# CHECK-COFF: Â }<br>
> +# CHECK-COFF: ]<br>
> +<br>
> +# CHECK-ELF: Relocations [<br>
> +# CHECK-ELF: Â Section {{.*}} .rel.debug_info {<br>
> +# CHECK-ELF: Â Â 0x6 R_386_32 .debug_abbrev<br>
> +# CHECK-ELF: Â }<br>
> +# CHECK-ELF: ]<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>