<div dir="ltr">What we are printing out is like this.<div><br></div><div><div><font face="monospace, monospace">Address          Size             Align Out     In      File    Symbol</font></div><div><span style="font-family:monospace,monospace">0000000000201000 0000000000000015     4 .text  </span><br></div><div><font face="monospace, monospace">0000000000201000 000000000000000e     4         .text  </font></div><div><font face="monospace, monospace">0000000000201000 000000000000000e     4                 /ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp1.o</font></div><div><font face="monospace, monospace">0000000000201000 0000000000000000     0                         _start </font></div><div><font face="monospace, monospace">0000000000201005 0000000000000000     0                         f(int) </font></div><div><font face="monospace, monospace">000000000020100e 0000000000000000     0                         local  </font></div><div><font face="monospace, monospace">0000000000201010 0000000000000002     4                 /ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp2.o</font></div><div><font face="monospace, monospace">0000000000201010 0000000000000000     0                         foo    </font></div><div><font face="monospace, monospace">0000000000201011 0000000000000000     0                         bar    </font></div><div><br></div></div><div>If we don't memorize the previous input section name, the output will become like this, no?</div><div><br></div><div><div><font face="monospace, monospace">0000000000201000 0000000000000015     4 .text  </font></div><div><font face="monospace, monospace">0000000000201000 000000000000000e     4         .text  </font></div><div><font face="monospace, monospace">0000000000201000 000000000000000e     4                 /ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp1.o</font></div><div><font face="monospace, monospace">0000000000201000 0000000000000000     0                         _start </font></div><div><font face="monospace, monospace">0000000000201005 0000000000000000     0                         f(int) </font></div><div><font face="monospace, monospace">000000000020100e 0000000000000000     0                         local  </font></div><div><font face="monospace, monospace"><b>0000000000201000 000000000000000e     4         .text  </b></font></div><div><font face="monospace, monospace">0000000000201010 0000000000000002     4                 /ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp2.o</font></div><div><font face="monospace, monospace">0000000000201010 0000000000000000     0                         foo    </font></div><div><font face="monospace, monospace">0000000000201011 0000000000000000     0                         bar    </font></div></div><div><font face="monospace, monospace"><br></font></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 28, 2017 at 11:32 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Why do we need CurSection? If two sections have the same name we will only print one, no?<br>
<br>
Cheers,<br>
Rafael<br><br><div class="gmail_quote"><span class="">On April 28, 2017 1:50:23 PM EDT, Rui Ueyama via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<pre class="m_8235757778211544576k9mail"><span class="">Author: ruiu<br>Date: Fri Apr 28 12:50:23 2017<br>New Revision: 301661<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=301661&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=301661&view=rev</a><br>Log:<br>Remove a redundant local variable.<br><br>Modified:<br>    lld/trunk/ELF/MapFile.cpp<br><br>Modified: lld/trunk/ELF/MapFile.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=301661&r1=301660&r2=301661&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/MapFile.<wbr>cpp?rev=301661&r1=301660&r2=<wbr>301661&view=diff</a><br></span><hr><span class=""><br>--- lld/trunk/ELF/MapFile.cpp (original)<br>+++ lld/trunk/ELF/MapFile.cpp Fri Apr 28 12:50:23 2017<br>@@ -117,12 +117,11 @@ void PrettyPrinter<ELFT>::<wbr>writeInputSect<br>   //   00201000 0000000e     4                 test.o<br>   //<br>   // once for each new input section.<br>-  StringRef Name = IS->Name;<br>-  if (Name != CurSection) {<br>+  if (IS->Name != CurSection) {<br>     writeHeader<ELFT>(OS, IS->OutSec->Addr + IS->OutSecOff, IS->getSize(),<br>                       IS->Alignment);<br>-    OS << indent(1) << left_justify(Name, 7) << '\n';<br>-    CurSection = Name;<br>+    OS << indent(1) << left_justify(IS->Name, 7) << '\n';<br>+    CurSection = IS->Name;<br>   }<br> <br>   // Write a line for each symbol defined in the given section.<br><br><br><hr><br></span><span class="">llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br></span></pre></blockquote></div><span class="HOEnZb"><font color="#888888"><br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my brevity.</font></span></div></blockquote></div><br></div></div>