diff options
author | Fangrui Song <maskray@google.com> | 2019-09-07 01:38:56 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-09-07 01:38:56 +0000 |
commit | 78b6909fd545cb4b62d791a7be1b2412defcb966 (patch) | |
tree | 7e0e86b589fac90f0cbe7d96424fd7fc36c538e3 /llvm/tools/llvm-objcopy | |
parent | 5b0a687d891e661432dc2a12637a9a956ad68f78 (diff) | |
download | bcm5719-llvm-78b6909fd545cb4b62d791a7be1b2412defcb966.tar.gz bcm5719-llvm-78b6909fd545cb4b62d791a7be1b2412defcb966.zip |
[llvm-objcopy] Rename SHOffset (e_shoff) field to SHOff. NFC
Similar to D67254.
`struct Elf*_Shdr` has a field `sh_offset`. Rename SHOffset to SHOff to
avoid confusion.
llvm-svn: 371281
Diffstat (limited to 'llvm/tools/llvm-objcopy')
-rw-r--r-- | llvm/tools/llvm-objcopy/ELF/Object.cpp | 12 | ||||
-rw-r--r-- | llvm/tools/llvm-objcopy/ELF/Object.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp index 44e6bf54b28..3d1527cc2ae 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -1689,7 +1689,7 @@ template <class ELFT> void ELFWriter<ELFT>::writeEhdr() { Ehdr.e_ehsize = sizeof(Elf_Ehdr); if (WriteSectionHeaders && Obj.sections().size() != 0) { Ehdr.e_shentsize = sizeof(Elf_Shdr); - Ehdr.e_shoff = Obj.SHOffset; + Ehdr.e_shoff = Obj.SHOff; // """ // If the number of sections is greater than or equal to // SHN_LORESERVE (0xff00), this member has the value zero and the actual @@ -1728,7 +1728,7 @@ template <class ELFT> void ELFWriter<ELFT>::writeShdrs() { // This reference serves to write the dummy section header at the begining // of the file. It is not used for anything else Elf_Shdr &Shdr = - *reinterpret_cast<Elf_Shdr *>(Buf.getBufferStart() + Obj.SHOffset); + *reinterpret_cast<Elf_Shdr *>(Buf.getBufferStart() + Obj.SHOff); Shdr.sh_name = 0; Shdr.sh_type = SHT_NULL; Shdr.sh_flags = 0; @@ -1954,16 +1954,16 @@ template <class ELFT> void ELFWriter<ELFT>::assignOffsets() { // Offset so that SHOffset is valid. if (WriteSectionHeaders) Offset = alignTo(Offset, sizeof(Elf_Addr)); - Obj.SHOffset = Offset; + Obj.SHOff = Offset; } template <class ELFT> size_t ELFWriter<ELFT>::totalSize() const { // We already have the section header offset so we can calculate the total // size by just adding up the size of each section header. if (!WriteSectionHeaders) - return Obj.SHOffset; + return Obj.SHOff; size_t ShdrCount = Obj.sections().size() + 1; // Includes null shdr. - return Obj.SHOffset + ShdrCount * sizeof(Elf_Shdr); + return Obj.SHOff + ShdrCount * sizeof(Elf_Shdr); } template <class ELFT> Error ELFWriter<ELFT>::write() { @@ -2085,7 +2085,7 @@ template <class ELFT> Error ELFWriter<ELFT>::finalize() { // Finally now that all offsets and indexes have been set we can finalize any // remaining issues. - uint64_t Offset = Obj.SHOffset + sizeof(Elf_Shdr); + uint64_t Offset = Obj.SHOff + sizeof(Elf_Shdr); for (SectionBase &Sec : Obj.sections()) { Sec.HeaderOffset = Offset; Offset += sizeof(Elf_Shdr); diff --git a/llvm/tools/llvm-objcopy/ELF/Object.h b/llvm/tools/llvm-objcopy/ELF/Object.h index 70be6bed422..0ff455d540f 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.h +++ b/llvm/tools/llvm-objcopy/ELF/Object.h @@ -1019,7 +1019,7 @@ public: uint8_t OSABI; uint8_t ABIVersion; uint64_t Entry; - uint64_t SHOffset; + uint64_t SHOff; uint32_t Type; uint32_t Machine; uint32_t Version; |