[PATCH] D67254: [yaml2obj] Rename SHOffset (e_shoff) field to SHOff
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 22:23:59 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`struct Elf*_Shdr` has a field `sh_offset`, named `ShOffset` in
ObjectYAML. Rename SHOffset (e_shoff) to SHOff to prevent confusion.
Repository:
rL LLVM
https://reviews.llvm.org/D67254
Files:
include/llvm/ObjectYAML/ELFYAML.h
lib/ObjectYAML/ELFEmitter.cpp
lib/ObjectYAML/ELFYAML.cpp
test/tools/yaml2obj/elf-header-sh-fields.yaml
Index: test/tools/yaml2obj/elf-header-sh-fields.yaml
===================================================================
--- test/tools/yaml2obj/elf-header-sh-fields.yaml
+++ test/tools/yaml2obj/elf-header-sh-fields.yaml
@@ -35,7 +35,7 @@
Type: ET_REL
Machine: EM_X86_64
SHEntSize: 64
- SHOffset: 2
+ SHOff: 2
SHNum: 3
SHStrNdx: 4
@@ -56,6 +56,6 @@
Type: ET_REL
Machine: EM_X86_64
SHEntSize: 1
- SHOffset: 2
+ SHOff: 2
SHNum: 3
SHStrNdx: 4
Index: lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- lib/ObjectYAML/ELFYAML.cpp
+++ lib/ObjectYAML/ELFYAML.cpp
@@ -824,7 +824,7 @@
IO.mapOptional("Entry", FileHdr.Entry, Hex64(0));
IO.mapOptional("SHEntSize", FileHdr.SHEntSize);
- IO.mapOptional("SHOffset", FileHdr.SHOffset);
+ IO.mapOptional("SHOff", FileHdr.SHOff);
IO.mapOptional("SHNum", FileHdr.SHNum);
IO.mapOptional("SHStrNdx", FileHdr.SHStrNdx);
}
Index: lib/ObjectYAML/ELFEmitter.cpp
===================================================================
--- lib/ObjectYAML/ELFEmitter.cpp
+++ lib/ObjectYAML/ELFEmitter.cpp
@@ -234,11 +234,10 @@
Doc.Header.SHEntSize ? (uint16_t)*Doc.Header.SHEntSize : sizeof(Elf_Shdr);
// Immediately following the ELF header and program headers.
// Align the start of the section header and write the ELF header.
- uint64_t ShOffset;
- CBA.getOSAndAlignedOffset(ShOffset, sizeof(typename ELFT::uint));
- Header.e_shoff = Doc.Header.SHOffset
- ? typename ELFT::uint(*Doc.Header.SHOffset)
- : ShOffset;
+ uint64_t SHOff;
+ CBA.getOSAndAlignedOffset(SHOff, sizeof(typename ELFT::uint));
+ Header.e_shoff =
+ Doc.Header.SHOff ? typename ELFT::uint(*Doc.Header.SHOff) : SHOff;
Header.e_shnum =
Doc.Header.SHNum ? (uint16_t)*Doc.Header.SHNum : Doc.Sections.size();
Header.e_shstrndx = Doc.Header.SHStrNdx ? (uint16_t)*Doc.Header.SHStrNdx
Index: include/llvm/ObjectYAML/ELFYAML.h
===================================================================
--- include/llvm/ObjectYAML/ELFYAML.h
+++ include/llvm/ObjectYAML/ELFYAML.h
@@ -75,7 +75,7 @@
llvm::yaml::Hex64 Entry;
Optional<llvm::yaml::Hex16> SHEntSize;
- Optional<llvm::yaml::Hex64> SHOffset;
+ Optional<llvm::yaml::Hex64> SHOff;
Optional<llvm::yaml::Hex16> SHNum;
Optional<llvm::yaml::Hex16> SHStrNdx;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67254.219026.patch
Type: text/x-patch
Size: 2422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190906/5bafbaa3/attachment.bin>
More information about the llvm-commits
mailing list