<div dir="ltr">Then maybe we should just use toString(InputSection) to print out a section name and its filename as one column?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 28, 2017 at 12:44 PM, Rafael Espíndola <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">OK, I think I just noticed something odd about the format. Each input<br>
section can only be from one file, so we should probably print<br>
<br>
out_addr   out_size    out_align .  out_name<br>
in_addr1   in_size1     in_align1   <nothing> .  in_name1 in_file1<br>
...........<br>
                                sym1<br>
...........<br>
                                sym2<br>
in_addr2  in_size2     in_align2   <nothing> .  in_name2 in_file2<br>
<br>
That is, move the file to the same line we print the input section<br>
name. What do you think?<br>
<br>
Cheers,<br>
Rafael<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 28 April 2017 at 14:49, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> What we are printing out is like this.<br>
><br>
> Address          Size             Align Out     In      File    Symbol<br>
> 0000000000201000 0000000000000015     4 .text<br>
> 0000000000201000 000000000000000e     4         .text<br>
> 0000000000201000 000000000000000e     4<br>
> /ssd/b/tools/lld/test/ELF/<wbr>Output/map-file.s.tmp1.o<br>
> 0000000000201000 0000000000000000     0                         _start<br>
> 0000000000201005 0000000000000000     0                         f(int)<br>
> 000000000020100e 0000000000000000     0                         local<br>
> 0000000000201010 0000000000000002     4<br>
> /ssd/b/tools/lld/test/ELF/<wbr>Output/map-file.s.tmp2.o<br>
> 0000000000201010 0000000000000000     0                         foo<br>
> 0000000000201011 0000000000000000     0                         bar<br>
><br>
> If we don't memorize the previous input section name, the output will become<br>
> like this, no?<br>
><br>
> 0000000000201000 0000000000000015     4 .text<br>
> 0000000000201000 000000000000000e     4         .text<br>
> 0000000000201000 000000000000000e     4<br>
> /ssd/b/tools/lld/test/ELF/<wbr>Output/map-file.s.tmp1.o<br>
> 0000000000201000 0000000000000000     0                         _start<br>
> 0000000000201005 0000000000000000     0                         f(int)<br>
> 000000000020100e 0000000000000000     0                         local<br>
> 0000000000201000 000000000000000e     4         .text<br>
> 0000000000201010 0000000000000002     4<br>
> /ssd/b/tools/lld/test/ELF/<wbr>Output/map-file.s.tmp2.o<br>
> 0000000000201010 0000000000000000     0                         foo<br>
> 0000000000201011 0000000000000000     0                         bar<br>
><br>
><br>
> On Fri, Apr 28, 2017 at 11:32 AM, Rafael Avila de Espindola<br>
> <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
>><br>
>> Why do we need CurSection? If two sections have the same name we will only<br>
>> print one, no?<br>
>><br>
>> Cheers,<br>
>> Rafael<br>
>><br>
>> On April 28, 2017 1:50:23 PM EDT, Rui Ueyama via llvm-commits<br>
>> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> 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" rel="noreferrer" 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:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=301661&r1=301660&r2=301661&view=diff" rel="noreferrer" 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>
>>> ______________________________<wbr>__<br>
>>><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,<br>
>>> 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>
>>> ______________________________<wbr>__<br>
>>><br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
>> --<br>
>> Sent from my Android device with K-9 Mail. Please excuse my brevity.<br>
><br>
><br>
</div></div></blockquote></div><br></div>