<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="font-size: 12pt;">From what I see it is would be very strange if lld change the input file content,</span><br>
</p>
<div>we use parsers in a very straightforward way:<br>
</div>
<div><br>
</div>
<div>
<div>template <class ELFT></div>
<div>GdbIndexBuilder<ELFT>::GdbIndexBuilder(InputSection<ELFT> *DebugInfoSec)</div>
<div>    : DebugInfoSec(DebugInfoSec) {</div>
<div>  if (Expected<std::unique_ptr<object::ObjectFile>> Obj =</div>
<div>          object::ObjectFile::createObjectFile(DebugInfoSec->getFile()->MB))</div>
<div>    Dwarf.reset(new DWARFContextInMemory(*Obj.get(), this));</div>
<div>  else</div>
<div>    error(toString(DebugInfoSec->getFile()) + ": error creating DWARF context");</div>
<div>}<br>
</div>
<div><br>
</div>
and when I compare code with/without your patch I just see that<br>
</div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">Dwarf->compile_units()</span>​ starts to return nothing, what is a reason of fail for testcase:<br>
</div>
<div><br>
</div>
<div>
<div>GdbIndexBuilder<ELFT>::readAddressArea(size_t CurrentCU) {</div>
<div>...<br>
</div>
<div>  for (const auto &CU : Dwarf->compile_units()) { // <-- HERE<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>You wrote "Is this data somehow modified by lld rather than being the raw bytes from the input file ?",<br>
</div>
<div>I see no reasons for that now. But what I suggest - let me check that all tomorrow,<br>
</div>
<div>I'll try to debug the details. <br>
</div>
<div><br>
</div>
<div>As far I understand is what I need - is just to recheck<br>
</div>
<div>that we pass the same data to <span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">DWARFConte</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">xtInMemory</span>​
<span style="font-size: 12pt;">that we have in raw objects.</span></div>
</div>
<div>I would be surprised if that is not true.<br>
</div>
<p><br>
</p>
<div id="Signature">
<div class="BodyFragment"><font size="2">
<div class="PlainText">Best regards,<br>
George.</div>
</font></div>
</div>
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>От:</b> George Rimar<br>
<b>Отправлено:</b> 20 декабря 2016 г. 21:16<br>
<b>Кому:</b> David Blaikie<br>
<b>Копия:</b> Rui Ueyama; llvm-commits@lists.llvm.org<br>
<b>Тема:</b> RE: [llvm] r289961 - Revert "dwarfdump: Support/process relocations on a CU's abbrev_off"</font>
<div> </div>
</div>
<div>
<p>​Hi David,<br>
</p>
<p><br>
</p>
<p>I'll can apply this patch and take a look on this closer </p>
<p>in a next hour or two and will be able to answer then.<br>
</p>
<p>​<br>
</p>
<div id="Signature">
<div class="BodyFragment"><font size="2">
<div class="PlainText">Best regards,<br>
George.</div>
</font></div>
</div>
<div style="color:rgb(33,33,33)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>От:</b> David Blaikie <dblaikie@gmail.com><br>
<b>Отправлено:</b> 20 декабря 2016 г. 21:02<br>
<b>Кому:</b> llvm-commits@lists.llvm.org; George Rimar<br>
<b>Копия:</b> Rui Ueyama<br>
<b>Тема:</b> Re: [llvm] r289961 - Revert "dwarfdump: Support/process relocations on a CU's abbrev_off"</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi George,<br>
<br>
Committing this change broke your gdb-index test in lld.<br>
<br>
It looks like the info section had a non-zero offset in the relocation pointing to the abbrev section, but the abbrev section in the object has the data at start (& dumping the raw object file from disk shows the relocation has a zero offset)<br>
<br>
Is this data somehow modified by lld rather than being the raw bytes from the input file? How/why/where?<br>
<br>
Any idea how to fix this change/lld so it doesn't have this problem?<br>
<br>
As it is, dwarfdump is crashing on inputs I care about & this change seems like a reasonable fix for it, so I'm guessing we probably want to fix lld in some way?<br>
<br>
- Dave<br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, Dec 16, 2016 at 9:20 AM David Blaikie via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Author: dblaikie<br class="gmail_msg">
Date: Fri Dec 16 11:10:17 2016<br class="gmail_msg">
New Revision: 289961<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289961&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=289961&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
Revert "dwarfdump: Support/process relocations on a CU's abbrev_off"<br class="gmail_msg">
<br class="gmail_msg">
Reverting because this breaks lld's gdb_index support - it's probably<br class="gmail_msg">
double counting the abbrev relocation offset.<br class="gmail_msg">
<br class="gmail_msg">
This reverts commit r289954.<br class="gmail_msg">
<br class="gmail_msg">
Removed:<br class="gmail_msg">
    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64<br class="gmail_msg">
    llvm/trunk/test/DebugInfo/dwarfdump-abbrev-off.test<br class="gmail_msg">
Modified:<br class="gmail_msg">
    llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=289961&r1=289960&r2=289961&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=289961&r1=289960&r2=289961&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Fri Dec 16 11:10:17 2016<br class="gmail_msg">
@@ -87,10 +87,7 @@ bool DWARFUnit::getStringOffsetSectionIt<br class="gmail_msg">
 bool DWARFUnit::extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) {<br class="gmail_msg">
   Length = debug_info.getU32(offset_ptr);<br class="gmail_msg">
   Version = debug_info.getU16(offset_ptr);<br class="gmail_msg">
-  auto AI = InfoSection.Relocs.find(*offset_ptr);<br class="gmail_msg">
   uint64_t AbbrOffset = debug_info.getU32(offset_ptr);<br class="gmail_msg">
-  if (AI != InfoSection.Relocs.end())<br class="gmail_msg">
-    AbbrOffset += AI->second.second;<br class="gmail_msg">
   if (IndexEntry) {<br class="gmail_msg">
     if (AbbrOffset)<br class="gmail_msg">
       return false;<br class="gmail_msg">
<br class="gmail_msg">
Removed: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64?rev=289960&view=auto" rel="noreferrer" class="gmail_msg" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64?rev=289960&view=auto</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
Binary files llvm/trunk/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64 (original) and llvm/trunk/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64 (removed) differ<br class="gmail_msg">
<br class="gmail_msg">
Removed: llvm/trunk/test/DebugInfo/dwarfdump-abbrev-off.test<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-abbrev-off.test?rev=289960&view=auto" rel="noreferrer" class="gmail_msg" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-abbrev-off.test?rev=289960&view=auto</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/test/DebugInfo/dwarfdump-abbrev-off.test (original)<br class="gmail_msg">
+++ llvm/trunk/test/DebugInfo/dwarfdump-abbrev-off.test (removed)<br class="gmail_msg">
@@ -1,8 +0,0 @@<br class="gmail_msg">
-RUN: llvm-dwarfdump -debug-dump=info %p/Inputs/dwarfdump-abbrev-off.elf-x86-64 | FileCheck %s<br class="gmail_msg">
-<br class="gmail_msg">
-Check that we apply relocations to the abbr_offset - while LLVM never produces<br class="gmail_msg">
-an object file like this, a reproduction can be produced by linking two simple<br class="gmail_msg">
-object files together with ld -r.<br class="gmail_msg">
-<br class="gmail_msg">
-CHECK: abbr_offset = 0x0000<br class="gmail_msg">
-CHECK: abbr_offset = 0x0010<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>