[lld] r301661 - Remove a redundant local variable.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 11:49:19 PDT 2017


What we are printing out is like this.

Address          Size             Align Out     In      File    Symbol
0000000000201000 0000000000000015     4 .text
0000000000201000 000000000000000e     4         .text
0000000000201000 000000000000000e     4
/ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp1.o
0000000000201000 0000000000000000     0                         _start
0000000000201005 0000000000000000     0                         f(int)
000000000020100e 0000000000000000     0                         local
0000000000201010 0000000000000002     4
/ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp2.o
0000000000201010 0000000000000000     0                         foo
0000000000201011 0000000000000000     0                         bar

If we don't memorize the previous input section name, the output will
become like this, no?

0000000000201000 0000000000000015     4 .text
0000000000201000 000000000000000e     4         .text
0000000000201000 000000000000000e     4
/ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp1.o
0000000000201000 0000000000000000     0                         _start
0000000000201005 0000000000000000     0                         f(int)
000000000020100e 0000000000000000     0                         local
*0000000000201000 000000000000000e     4         .text  *
0000000000201010 0000000000000002     4
/ssd/b/tools/lld/test/ELF/Output/map-file.s.tmp2.o
0000000000201010 0000000000000000     0                         foo
0000000000201011 0000000000000000     0                         bar


On Fri, Apr 28, 2017 at 11:32 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Why do we need CurSection? If two sections have the same name we will only
> print one, no?
>
> Cheers,
> Rafael
>
> On April 28, 2017 1:50:23 PM EDT, Rui Ueyama via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>>
>> Author: ruiu
>> Date: Fri Apr 28 12:50:23 2017
>> New Revision: 301661
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=301661&view=rev
>> Log:
>> Remove a redundant local variable.
>>
>> Modified:
>>     lld/trunk/ELF/MapFile.cpp
>>
>> Modified: lld/trunk/ELF/MapFile.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=301661&r1=301660&r2=301661&view=diff
>> ------------------------------
>>
>> --- lld/trunk/ELF/MapFile.cpp (original)
>> +++ lld/trunk/ELF/MapFile.cpp Fri Apr 28 12:50:23 2017
>> @@ -117,12 +117,11 @@ void PrettyPrinter<ELFT>::writeInputSect
>>    //   00201000 0000000e     4                 test.o
>>    //
>>    // once for each new input section.
>> -  StringRef Name = IS->Name;
>> -  if (Name != CurSection) {
>> +  if (IS->Name != CurSection) {
>>      writeHeader<ELFT>(OS, IS->OutSec->Addr + IS->OutSecOff, IS->getSize(),
>>                        IS->Alignment);
>> -    OS << indent(1) << left_justify(Name, 7) << '\n';
>> -    CurSection = Name;
>> +    OS << indent(1) << left_justify(IS->Name, 7) << '\n';
>> +    CurSection = IS->Name;
>>    }
>>
>>    // Write a line for each symbol defined in the given section.
>>
>>
>> ------------------------------
>>
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170428/26a1e36c/attachment.html>


More information about the llvm-commits mailing list