Reapply: Allow yaml2obj to order implicit sections for ELF
authorDave Lee <davelee.com@gmail.com>
Thu, 9 Nov 2017 14:53:43 +0000 (14:53 +0000)
committerDave Lee <davelee.com@gmail.com>
Thu, 9 Nov 2017 14:53:43 +0000 (14:53 +0000)
commit17307d9d33ab3733e087038b679ee65d43c8a373
tree28ada97ad34b19e7dafba0c31e778420114a12e3
parenta47514ce3faac5c682bf1edea37a3fcce59aa703
Reapply: Allow yaml2obj to order implicit sections for ELF

Summary:
This change allows yaml input to control the order of implicitly added sections
(`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a
placeholder section of the given name to the Sections field.

This change is to support changes in D39582, where it is desirable to control
the location of the `.dynsym` section.

This reapplied version fixes:
  1. use of a function call within an assert
  2. failing lld test which has an unnamed section
  3. incorrect section count when given an unnamed section

Additionally, one more test to cover the unnamed section failure.

Reviewers: compnerd, jakehehrlich

Reviewed By: jakehehrlich

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D39749

llvm-svn: 317789
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/yaml2obj/section-ordering.yaml [new file with mode: 0644]
llvm/test/tools/yaml2obj/unnamed-section.yaml [new file with mode: 0644]
llvm/tools/yaml2obj/yaml2elf.cpp