[PATCH] D64913: [yaml2obj] - Add a support for defining null sections in YAMLs.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 05:05:22 PDT 2019


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

ELF spec shows (Figure 4-10: Section Header Table Entry:Index 0,
http://www.sco.com/developers/gabi/latest/ch4.sheader.html)
that section header at index 0 (null section) can have `sh_size` and
`sh_link` fields set to non-zero values.

It says (https://docs.oracle.com/cd/E19683-01/817-3677/6mj8mbtc9/index.html):

> If the number of sections is greater than or equal to SHN_LORESERVE (0xff00),
>  this member has the value zero and the actual number of section header table
>  entries is contained in the sh_size field of the section header at index 0.
>  Otherwise, the sh_size member of the initial entry contains 0.

and:

> If the section name string table section index is greater than or equal to SHN_LORESERVE
>  (0xff00), this member has the value SHN_XINDEX (0xffff) and the actual index of the section
>  name string table section is contained in thesh_link field of the section header at index 0.
>  Otherwise, the sh_link member of the initial entry contains 0.

At this moment it is not possible to create custom section headers at index 0 using yaml2obj.
This patch implements this.


https://reviews.llvm.org/D64913

Files:
  test/tools/yaml2obj/elf-custom-null-section.yaml
  tools/yaml2obj/yaml2elf.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64913.210529.patch
Type: text/x-patch
Size: 8221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190718/c4cd7a0f/attachment.bin>


More information about the llvm-commits mailing list