[PATCH] D67221: [yaml2obj] Write the section header table after section contents

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 05:03:56 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson.
Herald added subscribers: llvm-commits, seiya, rupprecht.
Herald added a project: LLVM.

Linkers (ld.bfd/gold/lld) place the section header table at the very
end. The section header table is optional in executable/shared objects,
so this allows tools to strip it. In addition, if we add or remove a
section, the size of the section header table will change. Placing the
section header table in the end keeps section offsets unchanged.

yaml2obj currently places the section header table immediately after the
program header. Follow what linkers do to make offset updating easier.


Repository:
  rL LLVM

https://reviews.llvm.org/D67221

Files:
  lib/ObjectYAML/ELFEmitter.cpp
  test/Object/invalid.test
  test/tools/llvm-readobj/elf-wrong-shstrtab-type.test
  test/tools/llvm-readobj/gnu-sections.test
  test/tools/llvm-readobj/reloc-types-elf-i386.test
  test/tools/llvm-readobj/reloc-types-elf-x64.test
  test/tools/llvm-readobj/unwind.test
  test/tools/yaml2obj/dynsymtab-implicit-sections-size-content.yaml
  test/tools/yaml2obj/elf-custom-null-section.yaml
  test/tools/yaml2obj/elf-header-sh-fields.yaml
  test/tools/yaml2obj/elf-override-shsize.yaml
  test/tools/yaml2obj/explicit-dynsym-no-dynstr.yaml
  test/tools/yaml2obj/implicit-sections.test
  test/tools/yaml2obj/program-header-align.yaml
  test/tools/yaml2obj/section-size-content.yaml
  test/tools/yaml2obj/strtab-implicit-sections-size-content.yaml
  test/tools/yaml2obj/symtab-implicit-sections-size-content.yaml
  test/tools/yaml2obj/versym-section.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67221.218895.patch
Type: text/x-patch
Size: 24731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190905/ffb63d3d/attachment.bin>


More information about the llvm-commits mailing list