[lld] r301661 - Remove a redundant local variable.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 12:44:18 PDT 2017


OK, I think I just noticed something odd about the format. Each input
section can only be from one file, so we should probably print

out_addr   out_size    out_align .  out_name
in_addr1   in_size1     in_align1   <nothing> .  in_name1 in_file1
...........
                                sym1
...........
                                sym2
in_addr2  in_size2     in_align2   <nothing> .  in_name2 in_file2

That is, move the file to the same line we print the input section
name. What do you think?

Cheers,
Rafael



On 28 April 2017 at 14:49, Rui Ueyama <ruiu at google.com> wrote:
> 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.
>
>


More information about the llvm-commits mailing list