[PATCH] D13544: ELF2: Make SymbolTable a template class.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 20:04:08 PDT 2015


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

SymbolTable was not a template class. Instead we had switch-case-based
type dispatch to call desired functions. We had to do that because
SymbolTable was created before we know what ELF type objects had been
passed.

What become more convnient as I tried to add more features to the
driver because every time I tried to add a new function to the symbol
table, I had to define a dispatcher which consist of a single switch
statement.

It also brought an restriction what the driver can do. For example,
we cannot add undefined symbols before any files are added to the symbol
table. That's because no symbols can be added until the symbol table
knows the ELF type, but when it knows about that, it's too late.

In this patch, the driver makes a decision on what ELF type objects
are being handled. Then the driver creates a SymbolTable object for
an appropriate ELF type.

http://reviews.llvm.org/D13544

Files:
  ELF/Driver.cpp
  ELF/Driver.h
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/SymbolTable.cpp
  ELF/SymbolTable.h
  ELF/Writer.cpp
  ELF/Writer.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13544.36822.patch
Type: text/x-patch
Size: 17719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151008/6635cdef/attachment.bin>


More information about the llvm-commits mailing list