]> granicus.if.org Git - llvm/commit
[yaml2obj] - Add a support for defining null sections in YAMLs.
authorGeorge Rimar <grimar@accesssoftek.com>
Tue, 23 Jul 2019 11:03:37 +0000 (11:03 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Tue, 23 Jul 2019 11:03:37 +0000 (11:03 +0000)
commitf250d707f2d754927e6c82cc9d4e32647907f2d9
treef9d57fc39747b882d527cc31653a3b2f0f45b01b
parent63ec074d6eb4eb2458942a649f788bb4c5c5bb23
[yaml2obj] - Add a support for defining null sections in YAMLs.

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 the sh_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.

Differential revision: https://reviews.llvm.org/D64913

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366794 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/yaml2obj/elf-custom-null-section.yaml [new file with mode: 0644]
tools/yaml2obj/yaml2elf.cpp