[PATCH] D22433: Handle versioned symbols efficiently.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 18:54:43 PDT 2016


ruiu created this revision.
ruiu added a reviewer: grimar.
ruiu added a subscriber: llvm-commits.

Versions can be assigned to symbols in two different ways.
One is the usual version scripts, and the other is special
symbol suffix '@'. If a symbol contains '@', the string after
that is considered to specify a version name.

Previously, we look for '@' for all symbols.

Anything that works on every symbol can be expensive because
the linker has to handle a lot of symbols. The search for '@'
was not an exception.

In this patch, I made two optimizations.

The first optimization is to handle '@' only when at least one
version is defined. If no versions are defined, no versions can
be assigned to any symbols, so it's waste of time to search for '@'.

The second optimization is to scan only suffixes of symbol names
instead of entire symbol names. Symbol names can be very long, but
symbol versions are usually short, so scanning entire symbol names
is waste of time, too.

There are some error cases which we no longer be able to detect
with this patch. I don't think it's a major drawback because they
are minor errors. Speed is more important.

This change improves LLD with debug info self-link time from
6.6993 seconds to 6.3426 seconds (or -5.3%).

https://reviews.llvm.org/D22433

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/SymbolTable.cpp
  ELF/SymbolTable.h
  ELF/Symbols.cpp
  ELF/Symbols.h
  test/ELF/verdef-defaultver.s
  test/ELF/verdef-executable.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22433.64219.patch
Type: text/x-patch
Size: 16185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160716/135e3be0/attachment.bin>


More information about the llvm-commits mailing list