[yaml2obj, obj2yaml] - Add support for SHT_NOTE sections.
authorgeorgerim <georgerim@gmail.com>
Fri, 25 Oct 2019 10:03:19 +0000 (13:03 +0300)
committergeorgerim <georgerim@gmail.com>
Fri, 25 Oct 2019 10:25:56 +0000 (13:25 +0300)
commitde3cef1d5d33212059164d6095aca5c5b0284001
treeba617e1ffe517fbf1622d98b21ef6e5a25a3d659
parent8aa84ad37db7ddbff5c1a2e4ef8ff2a616f1da57
[yaml2obj, obj2yaml] - Add support for SHT_NOTE sections.

SHT_NOTE is the section that consists of
namesz, descsz, type, name + padding, desc + padding data.
This patch teaches yaml2obj, obj2yaml to dump and parse them.

This patch implements the section how it is described here:
https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-18048.html
Which says: "For 64–bit objects and 32–bit objects, each entry is an array of 4-byte words in
the format of the target processor"

The official specification is different
http://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section
And says: "n 64-bit objects (files with e_ident[EI_CLASS] equal to ELFCLASS64), each entry is an array
of 8-byte words in the format of the target processor. In 32-bit objects (files with e_ident[EI_CLASS]
equal to ELFCLASS32), each entry is an array of 4-byte words in the format of the target processor"

Since LLVM uses the first, 32-bit way, this patch follows it.

Differential revision: https://reviews.llvm.org/D68983
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/llvm-objcopy/ELF/set-section-alignment.test
llvm/test/tools/llvm-readobj/elf-section-types.test
llvm/test/tools/llvm-readobj/gnu-notes.test
llvm/test/tools/llvm-size/elf-sysv.test
llvm/test/tools/yaml2obj/implicit-sections-types.test
llvm/tools/obj2yaml/elf2yaml.cpp