[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases.
authorGeorgii Rymar <grimar@accesssoftek.com>
Wed, 10 Jun 2020 12:28:57 +0000 (15:28 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Thu, 11 Jun 2020 09:54:53 +0000 (12:54 +0300)
commit818ab3d654e41f99e25b0f19b633f2233b619c77
tree58b4ed71ac334ad6f86c43e7252f530ba7f0f680
parentafa42e4c9253ca111fdcb6238a0da34129475911
[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases.

This teaches yaml2obj to allocate file space for a no-bits section
when there is a non-nobits section in the same segment that follows it.

It was discussed in D78005 thread and matches GNU linkers and LLD behavior.

Differential revision: https://reviews.llvm.org/D80629
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
llvm/test/tools/obj2yaml/ELF/program-headers.yaml
llvm/test/tools/yaml2obj/ELF/program-header-nobits.yaml