OSDN Git Service

Change how readobj stores info about dynamic symbols.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 17 Feb 2016 15:38:21 +0000 (15:38 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 17 Feb 2016 15:38:21 +0000 (15:38 +0000)
commit7ecc477012cfec660a6f2d52807b25ccfa6eedac
tree9aba2fc1ebb81f1dfee984f7b53a13b452a00790
parentc264560dc82eb45d4b301f873cb73a81aaffd535
Change how readobj stores info about dynamic symbols.

We used to keep both a section and a pointer to the first symbol.

The oddity of keeping a section for dynamic symbols is because there is
a DT_SYMTAB but no DT_SYMTABZ, so to print the table we have to find the
size via a section table.

The reason for still keeping a pointer to the first symbol is because we
want to be able to print relocation tables even if the section table is
missing (it is mandatory only for files used in linking).

With this patch we keep just a DynRegionInfo. This then requires
changing a few places that were asking for a Elf_Shdr but actually just
needed the first symbol.

The test change is to delete the program header pointer.
Now that we use the information of both DT_SYMTAB and .dynsym, we don't
depend on the sh_entsize of .dynsym if we see DT_SYMTAB.

Note: It is questionable if it is worth it putting the effort to report
broken sh_entsize given that in files with no section table we have to
assume it is sizeof(Elf_Sym), but that is for another change.

Extracted from r260488.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261099 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Object/ELF.h
test/Object/Inputs/invalid-sh_entsize.elf
test/Object/invalid.test
tools/llvm-readobj/ELFDumper.cpp