Don't store an Elf_Sym for most symbols.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 4 Apr 2016 14:04:16 +0000 (14:04 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 4 Apr 2016 14:04:16 +0000 (14:04 +0000)
commitccfe3cb3d63e0a8244d3d41d537c27363cacc750
tree9bb810f41c31e90d6c37ec106f3ad5e16609e669
parenta9ac6d6cc225a25eb55c7edd8825780c44ee351e
Don't store an Elf_Sym for most symbols.

Our symbol representation was redundant, and some times would get out of
sync. It had an Elf_Sym, but some fields were copied to SymbolBody.

Different parts of the code were checking the bits in SymbolBody and
others were checking Elf_Sym.

There are two general approaches to fix this:
* Copy the required information and don't store and Elf_Sym.
* Don't copy the information and always use the Elf_Smy.

The second way sounds tempting, but has a big problem: we would have to
template SymbolBody. I started doing it, but it requires templeting
*everything* and creates a bit chicken and egg problem at the driver
where we have to find ELFT before we can create an ArchiveFile for
example.

As much as possible I compared the test differences with what gold and
bfd produce to make sure they are still valid. In most cases we are just
adding hidden visibility to a local symbol, which is harmless.

In most tests this is a small speedup. The only slowdown was scylla
(1.006X). The largest speedup was clang with no --build-id, -O3 or
--gc-sections (i.e.: focus on the relocations): 1.019X.

llvm-svn: 265293
21 files changed:
lld/ELF/Driver.cpp
lld/ELF/ICF.cpp
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h
lld/ELF/InputSection.cpp
lld/ELF/InputSection.h
lld/ELF/MarkLive.cpp
lld/ELF/OutputSections.cpp
lld/ELF/SymbolTable.cpp
lld/ELF/SymbolTable.h
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
lld/ELF/Target.cpp
lld/ELF/Writer.cpp
lld/test/ELF/aarch64-gnu-ifunc.s
lld/test/ELF/basic-mips.s
lld/test/ELF/global_offset_table_shared.s
lld/test/ELF/gnu-ifunc-i386.s
lld/test/ELF/gnu-ifunc.s
lld/test/ELF/mips-gp-disp.s
lld/test/ELF/mips-hilo-gp-disp.s