<div style="font-family:arial,helvetica,sans-serif"><font><div>--- test/DebugInfo/X86/DW_AT_location-reference.ll      (revision 0)</div><div>+++ test/DebugInfo/X86/DW_AT_location-reference.ll      (revision 0)</div>
<div>@@ -0,0 +1,108 @@</div><div>+; RUN: llc -O1 -mtriple=x86_64-apple-darwin < %s | FileCheck -check-prefix=DARWIN %s</div><div>+; RUN: llc -O1 -mtriple=x86_64-pc-linux-gnu < %s | FileCheck -check-prefix=LINUX %s</div>

<div>+;Bug 9493</div><div>+;Adapted from the original test case in r127757.</div><div><br></div><div>It's standard to say "; PR9493" instead of "Bug 9493". There used to be code in the test runner that would parse it and emit which PR's had regressed, but I think that code is gone?</div>

<div><br></div><div>I'm also concerned about the fact that this test runs llc -O1. It looks like this will work even if we change the register allocator only because we don't actually test the contents in the DWARF location anyhow. I don't know how easy this is to do, but it'd be great if you could simplify the .ll file or not run it with -O1. It's acceptable as-is if you can't simplify it, but I'm not looking forward to debugging why this test fails some day in the future.</div>

<div><br></div><div><div>Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp</div><div>===================================================================</div><div>--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp       (revision 158734)</div>

<div>+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp       (working copy)</div><div>@@ -1637,10 +1637,14 @@</div><div>       break;</div><div>     }</div><div>     case dwarf::DW_AT_location: {</div><div>-      if (DIELabel *L = dyn_cast<DIELabel>(Values[i]))</div>

<div>-        Asm->EmitLabelDifference(L->getValue(), DwarfDebugLocSectionSym, 4);</div><div>-      else</div><div>+      if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) {</div><div>+        if (Asm->MAI->doesDwarfUseLabelOffsetForRanges())</div>

<div>+          Asm->EmitReference(L->getValue(), dwarf::DW_EH_PE_udata4);</div><div>+        else</div><div>+          Asm->EmitLabelDifference(L->getValue(), DwarfDebugLocSectionSym, 4);</div><div>+      } else {</div>

<div>         Values[i]->EmitValue(Asm, Form);</div><div>+      }</div><div>       break;</div><div>     }</div></div><div><br></div><div>Why do we ignore "Form" when doesDwarfUseLabelOffsetForRanges() is true? EH_PE_udata4 can't possibly be right, it's prefixed with EH (exception handling) for starters. In DWARF2 which is (still) the only version of dwarf we support, your choices for form here are any of DW_FORM_data{1,2,4,8} or DW_FORM_block{1,2}. If the problem is GetSizeOfEncodedValue(), please extend that.</div>

<div><br></div><div>Feel free to rename to DwarfUsesRelocationsAcrossSections. Thanks!</div><div><br></div><div>Nick</div><br><div class="gmail_quote">On 19 June 2012 12:19, Robinson, Paul <span dir="ltr"><<a href="mailto:Paul.Robinson@am.sony.com" target="_blank">Paul.Robinson@am.sony.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<p>Ping, now that people should be recovered from that big conference last week.</p>
<p>--paulr</p>
<p> </p>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="DIRECTION:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a> [<a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a>] on behalf of Robinson, Paul [<a href="mailto:Paul.Robinson@am.sony.com" target="_blank">Paul.Robinson@am.sony.com</a>]<br>


<b>Sent:</b> Thursday, June 07, 2012 2:13 PM<br>
<b>To:</b> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> [llvm-commits] [PATCH] PR9493, Fix for DW_AT_location<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<p>Ping, with improved subject line.</p>
<p>--paulr</p>
<p> </p>
<div style="font-size:16px;font-family:Times New Roman">
<div style="DIRECTION:ltr"> </div>
<div></div>
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<p>My first patch attempt, here goes!</p>
<p> </p>
<p>Fix for bug 9493.  On non-Darwin platforms, references from DW_AT_location to the .debug_loc section need to be relocatable.  This patch improves on r127757, which didn't do the right thing for Darwin (and was reverted pretty quickly).</p>


<p> </p>
<p>The original bug showed up on ARM, but because of the Darwin/non-Darwin difference I revised the test to target x86_64, where it was easy to try both cases.  Also there isn't an ARM subdirectory under test/DebugInfo and I didn't want to get too ambitious
 on my first try.  The problem isn't really architecture-specific but it would be easy to create an ARM equivalent for the non-Darwin version of the test, if anybody thought that was useful.</p>
<p> </p>
<p>One question, I did not change the name of doesDwarfUseLabelOffsetForRanges() or its underlying data member DwarfUsesLabelOffsetForRanges. These used to apply only to the DW_AT_ranges attribute, but now they apply to DW_AT_location as well. Change the names,
 or not?  It seemed excessive to add a second function/flag because these DWARF attributes will always want to be handled the same way.  If renaming is better, maybe DwarfUsesRelocationsAcrossSections would be more accurate.<br>


</p>
<p>Thanks,</p>
<p>Paul Robinson</p>
<p> </p>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

<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>
<br></blockquote></div><br></font></div>