[PATCH] D92923: [llvm-readelf/obj][WIP] - Add support for multiple SHT_SYMTAB_SHNDX sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 02:20:48 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, atanasyan, arichardson, emaste.
Herald added a reviewer: espindola.
grimar requested review of this revision.
Herald added a project: LLVM.

Currently we don't support multiple SHT_SYMTAB_SHNDX sections
and the DT_SYMTAB_SHNDX tag currently.

This patch implements it and fixes the
https://bugs.llvm.org/show_bug.cgi?id=43991.

I am posting this patch as WIP, because there are still few missing test cases,
which I am going to add. At first I'd like to demonstrate the approach used though
to be sure it is generally looks fine.

Some API previously used the `ArrayRef<Elf_Word> ShndxTable` argument, which I had to replace
with a pointer and size. This is needed, because we don't know the size of the extended
section indices table when it is located via DT_SYMTAB_SHNDX.
In this case we can have `const Elf_Word *ShndxTable != nullptr, size_t ShndxTableSize == 0`,
what means we have a table of an unknown size.


https://reviews.llvm.org/D92923

Files:
  lld/ELF/InputFiles.cpp
  llvm/include/llvm/Object/ELF.h
  llvm/include/llvm/Object/ELFObjectFile.h
  llvm/test/Object/invalid.test
  llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test
  llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test
  llvm/test/tools/llvm-readobj/ELF/mips-got.test
  llvm/test/tools/llvm-readobj/ELF/mips-plt.test
  llvm/test/tools/llvm-readobj/ELF/section-symbols.test
  llvm/test/tools/llvm-readobj/ELF/symbol-shndx.test
  llvm/test/tools/llvm-readobj/ELF/symtab-shndx.test
  llvm/test/tools/obj2yaml/ELF/sht-symtab-shndx.yaml
  llvm/test/tools/yaml2obj/ELF/sht-symtab-shndx.yaml
  llvm/tools/llvm-readobj/ARMEHABIPrinter.h
  llvm/tools/llvm-readobj/ELFDumper.cpp
  llvm/tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92923.310466.patch
Type: text/x-patch
Size: 53879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201209/f30ac43f/attachment.bin>


More information about the llvm-commits mailing list