[PATCH] D65446: [yaml2obj/obj2yaml] - Add a basic support for extended section indexes.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 06:22:01 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added a subscriber: arphaman.

In some cases a symbol might have section index == SHN_XINDEX.
This is an escape value indicating that the actual section header index
is too large to fit in the containing field.
Then the SHT_SYMTAB_SHNDX section is used. It contains the 32bit values
that stores section indexes.

ELF gABI says that there can be multiple SHT_SYMTAB_SHNDX sections,
i.e. for example one for .symtab and one for .dynsym
(1) https://groups.google.com/forum/#!topic/generic-abi/-XJAV5d8PRg
(2) DT_SYMTAB_SHNDX: http://www.sco.com/developers/gabi/latest/ch5.dynamic.html

In this patch I am only supporting a single SHT_SYMTAB_SHNDX associated
with a .symtab. This is a more or less common case which is used a few tests I saw in LLVM.

I decided not to create the `SHT_SYMTAB_SHNDX` section as "implicit",
but implement is like a kind of regular section for now.
i.e. tools do not recreate this section or its content, like they do for
symbol table sections, for example. That should allow to write all kind of
possible broken test cases for our needs and keep the output closer to requested.


https://reviews.llvm.org/D65446

Files:
  include/llvm/Object/ELF.h
  lib/ObjectYAML/ELFYAML.cpp
  test/tools/obj2yaml/Inputs/shn_xindex.o
  test/tools/obj2yaml/elf-sht-symtab-shndx.yaml
  test/tools/obj2yaml/special-symbol-indices.yaml
  test/tools/yaml2obj/elf-sht-symtab-shndx.yaml
  tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65446.212328.patch
Type: text/x-patch
Size: 14561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190730/5f32a9d3/attachment-0001.bin>


More information about the llvm-commits mailing list