Index: llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h =================================================================== --- llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h +++ llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h @@ -75,7 +75,7 @@ llvm::yaml::Hex64 Entry; Optional SHEntSize; - Optional SHOffset; + Optional SHOff; Optional SHNum; Optional SHStrNdx; }; Index: llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp =================================================================== --- llvm/trunk/lib/ObjectYAML/ELFEmitter.cpp +++ llvm/trunk/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: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp =================================================================== --- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp +++ llvm/trunk/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: llvm/trunk/test/Object/invalid.test =================================================================== --- llvm/trunk/test/Object/invalid.test +++ llvm/trunk/test/Object/invalid.test @@ -597,7 +597,7 @@ - Type: SHT_NULL Size: 288230376151711744 -## Check the case when SHOffset is too large. SHOffset + sizeof(Elf_Shdr) overflows the uint64 type. +## Check the case when SHOff is too large. SHOff + sizeof(Elf_Shdr) overflows the uint64 type. # RUN: yaml2obj --docnum=28 %s -o %t28 # RUN: not llvm-readobj -h %t28 2>&1 | FileCheck -DFILE=%t28 --check-prefix=INVALID-SEC-NUM3 %s @@ -610,7 +610,7 @@ Data: ELFDATA2LSB Type: ET_REL Machine: EM_X86_64 - SHOffset: 0xffffffffffffffff + SHOff: 0xffffffffffffffff ## Check that llvm-objdump reports an error when it tries to dump a ## symbol name and .strtab is empty. Index: llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml =================================================================== --- llvm/trunk/test/tools/yaml2obj/elf-header-sh-fields.yaml +++ llvm/trunk/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: llvm/trunk/tools/obj2yaml/elf2yaml.cpp =================================================================== --- llvm/trunk/tools/obj2yaml/elf2yaml.cpp +++ llvm/trunk/tools/obj2yaml/elf2yaml.cpp @@ -139,7 +139,7 @@ template Expected ELFDumper::dump() { auto Y = std::make_unique(); - // Dump header. We do not dump SHEntSize, SHOffset, SHNum and SHStrNdx field. + // Dump header. We do not dump SHEntSize, SHOff, SHNum and SHStrNdx fields. // When not explicitly set, the values are set by yaml2obj automatically // and there is no need to dump them here. Y->Header.Class = ELFYAML::ELF_ELFCLASS(Obj.getHeader()->getFileClass());