[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases.
authorGeorgii Rymar <grimar@accesssoftek.com>
Tue, 26 May 2020 16:05:52 +0000 (19:05 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Tue, 2 Jun 2020 14:19:24 +0000 (17:19 +0300)
commitaa3a85cdaa4432ca389bdbf48049eaa64dc6e266
treeae6c782f80fe090158ead7711c51752b4fd4534b
parent6c733f5a1320977d24e7f5c565e55a6590e6ec8c
[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/yaml2obj/ELF/program-header-nobits.yaml