[yaml2obj][ELF] Add support for setting alignment in program headers

Sometimes program headers have larger alignments than any of the
sections they contain. Currently yaml2obj can't produce such files. A
bug recently appeared in llvm-objcopy that failed in such a case. I'd
like to be able to add tests to llvm-objcopy for such cases.

This change adds an optional alignment parameter to program headers that
will be used instead of calculating the alignment.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317139 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jake Ehrlich
2017-11-01 23:14:48 +00:00
parent 368924ad91
commit 9ae2da659f
4 changed files with 77 additions and 8 deletions
+1
View File
@@ -719,6 +719,7 @@ void MappingTraits<ELFYAML::ProgramHeader>::mapping(
IO.mapOptional("Sections", Phdr.Sections);
IO.mapOptional("VAddr", Phdr.VAddr, Hex64(0));
IO.mapOptional("PAddr", Phdr.PAddr, Hex64(0));
IO.mapOptional("Align", Phdr.Align);
}
namespace {