llvm/tools/llvm-readobj
Rafael Espindola 81c66bcc13 Create .symtab_shndxr only when needed.
We need .symtab_shndxr if and only if a symbol references a section with an
index >= 0xff00.

The old code was trying to figure out if the section was needed ahead of time,
making it a fairly dependent on the code actually writing the table. It was
also somewhat conservative and would create the section in cases where it was
not needed.

If I remember correctly, the old structure was there so that the sections were
created in the same order gas creates them. That was valuable when MC's support
for ELF was new and we tested with elf-dump.py.

This patch refactors the symbol table creation to another class and makes it
obvious that .symtab_shndxr is really only created when we are about to output
a reference to a section index >= 0xff00.

While here, also improve the tests to use macros. One file is one section
short of needing .symtab_shndxr, the second one has just the right number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204769 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 23:44:25 +00:00
..
ARMAttributeParser.cpp tools: fix Twine abuse 2014-01-30 06:19:27 +00:00
ARMAttributeParser.h tools: add support for decoding ARM attributes 2014-01-30 04:46:33 +00:00
ARMEHABIPrinter.h tools: cast the right operand 2014-02-09 03:13:07 +00:00
CMakeLists.txt tools: add support for decoding ARM attributes 2014-01-30 04:46:33 +00:00
COFFDumper.cpp Object: Provide a richer means of describing auxiliary symbols 2014-03-19 04:47:47 +00:00
ELFDumper.cpp Create .symtab_shndxr only when needed. 2014-03-25 23:44:25 +00:00
Error.cpp Support: Make error_category's constructor public 2014-03-15 04:05:59 +00:00
Error.h Add missing std:: qualifiers 2014-03-07 14:55:30 +00:00
llvm-readobj.cpp Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-readobj.h tools: add support for decoding ARM attributes 2014-01-30 04:46:33 +00:00
LLVMBuild.txt Don't link with the archive library programs that don't use it. 2013-06-17 15:29:46 +00:00
MachODumper.cpp [C++11] Introduce ObjectFile::symbols() to use range-based loops. 2014-03-17 07:28:19 +00:00
Makefile Don't link with the archive library programs that don't use it. 2013-06-17 15:29:46 +00:00
ObjDumper.cpp Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
ObjDumper.h Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
StreamWriter.cpp Implements low-level object file format specific output for COFF and 2013-04-03 18:31:38 +00:00
StreamWriter.h tools: add support for decoding ARM attributes 2014-01-30 04:46:33 +00:00