Don't invent names for STT_SECTION symbols.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 12 12:33:31 PST 2016


> We should just copy the symbol names with -r.
> ...
>-        // That can happen if creating relocatable output.
>-        if (Sym.getType() == STT_SECTION)
>-          SymName = Section->getSectionName();
 
Why not ?
I think it can't be treated as harmful change. But it has positive effect.
Let me repeat my explanaition of this change here again:

I did it to produce nice output that equals to gold now.
(Consider the source files from testcase of this patch are used):

Relocation section '.rela.eh_frame' at offset 0xa0 contains 3 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000020  000100000002 R_X86_64_PC32     0000000000000000 foo1 + 0
000000000034  000200000002 R_X86_64_PC32     0000000000000000 bar1 + 0
000000000048  000300000002 R_X86_64_PC32     0000000000000000 dah1 + 0

Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 _start

Without that lines of code you would not see "foo1 + 0", but only " + 0".

George.


More information about the llvm-commits mailing list