diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/Object/ELF.cpp | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Object/ELF.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Object/ELF.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/contrib/libs/llvm12/lib/Object/ELF.cpp b/contrib/libs/llvm12/lib/Object/ELF.cpp index 15d169f8c8..264f115ddb 100644 --- a/contrib/libs/llvm12/lib/Object/ELF.cpp +++ b/contrib/libs/llvm12/lib/Object/ELF.cpp @@ -152,13 +152,13 @@ StringRef llvm::object::getELFRelocationTypeName(uint32_t Machine, break; } break; - case ELF::EM_CSKY: - switch (Type) { -#include "llvm/BinaryFormat/ELFRelocs/CSKY.def" - default: - break; - } - break; + case ELF::EM_CSKY: + switch (Type) { +#include "llvm/BinaryFormat/ELFRelocs/CSKY.def" + default: + break; + } + break; default: break; } @@ -201,8 +201,8 @@ uint32_t llvm::object::getELFRelativeRelocationType(uint32_t Machine) { case ELF::EM_SPARC32PLUS: case ELF::EM_SPARCV9: return ELF::R_SPARC_RELATIVE; - case ELF::EM_CSKY: - return ELF::R_CKCORE_RELATIVE; + case ELF::EM_CSKY: + return ELF::R_CKCORE_RELATIVE; case ELF::EM_AMDGPU: break; case ELF::EM_BPF: @@ -276,7 +276,7 @@ StringRef llvm::object::getELFSectionTypeName(uint32_t Machine, unsigned Type) { STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_SYMPART); STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_PART_EHDR); STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_PART_PHDR); - STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_BB_ADDR_MAP); + STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_BB_ADDR_MAP); STRINGIFY_ENUM_CASE(ELF, SHT_GNU_ATTRIBUTES); STRINGIFY_ENUM_CASE(ELF, SHT_GNU_HASH); STRINGIFY_ENUM_CASE(ELF, SHT_GNU_verdef); @@ -288,7 +288,7 @@ StringRef llvm::object::getELFSectionTypeName(uint32_t Machine, unsigned Type) { } template <class ELFT> -std::vector<typename ELFT::Rel> +std::vector<typename ELFT::Rel> ELFFile<ELFT>::decode_relrs(Elf_Relr_Range relrs) const { // This function decodes the contents of an SHT_RELR packed relocation // section. @@ -320,10 +320,10 @@ ELFFile<ELFT>::decode_relrs(Elf_Relr_Range relrs) const { // even means address, odd means bitmap. // 2. Just a simple list of addresses is a valid encoding. - Elf_Rel Rel; - Rel.r_info = 0; - Rel.setType(getRelativeRelocationType(), false); - std::vector<Elf_Rel> Relocs; + Elf_Rel Rel; + Rel.r_info = 0; + Rel.setType(getRelativeRelocationType(), false); + std::vector<Elf_Rel> Relocs; // Word type: uint32_t for Elf32, and uint64_t for Elf64. typedef typename ELFT::uint Word; @@ -340,8 +340,8 @@ ELFFile<ELFT>::decode_relrs(Elf_Relr_Range relrs) const { Word Entry = R; if ((Entry&1) == 0) { // Even entry: encodes the offset for next relocation. - Rel.r_offset = Entry; - Relocs.push_back(Rel); + Rel.r_offset = Entry; + Relocs.push_back(Rel); // Set base offset for subsequent bitmap entries. Base = Entry + WordSize; continue; @@ -352,8 +352,8 @@ ELFFile<ELFT>::decode_relrs(Elf_Relr_Range relrs) const { while (Entry != 0) { Entry >>= 1; if ((Entry&1) != 0) { - Rel.r_offset = Offset; - Relocs.push_back(Rel); + Rel.r_offset = Offset; + Relocs.push_back(Rel); } Offset += WordSize; } @@ -367,7 +367,7 @@ ELFFile<ELFT>::decode_relrs(Elf_Relr_Range relrs) const { template <class ELFT> Expected<std::vector<typename ELFT::Rela>> -ELFFile<ELFT>::android_relas(const Elf_Shdr &Sec) const { +ELFFile<ELFT>::android_relas(const Elf_Shdr &Sec) const { // This function reads relocations in Android's packed relocation format, // which is based on SLEB128 and delta encoding. Expected<ArrayRef<uint8_t>> ContentsOrErr = getSectionContents(Sec); @@ -512,7 +512,7 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch, template <class ELFT> std::string ELFFile<ELFT>::getDynamicTagAsString(uint64_t Type) const { - return getDynamicTagAsString(getHeader().e_machine, Type); + return getDynamicTagAsString(getHeader().e_machine, Type); } template <class ELFT> @@ -542,7 +542,7 @@ Expected<typename ELFT::DynRange> ELFFile<ELFT>::dynamicEntries() const { for (const Elf_Shdr &Sec : *SectionsOrError) { if (Sec.sh_type == ELF::SHT_DYNAMIC) { Expected<ArrayRef<Elf_Dyn>> DynOrError = - getSectionContentsAsArray<Elf_Dyn>(Sec); + getSectionContentsAsArray<Elf_Dyn>(Sec); if (!DynOrError) return DynOrError.takeError(); Dyn = *DynOrError; @@ -566,8 +566,8 @@ Expected<typename ELFT::DynRange> ELFFile<ELFT>::dynamicEntries() const { } template <class ELFT> -Expected<const uint8_t *> -ELFFile<ELFT>::toMappedAddr(uint64_t VAddr, WarningHandler WarnHandler) const { +Expected<const uint8_t *> +ELFFile<ELFT>::toMappedAddr(uint64_t VAddr, WarningHandler WarnHandler) const { auto ProgramHeadersOrError = program_headers(); if (!ProgramHeadersOrError) return ProgramHeadersOrError.takeError(); @@ -578,22 +578,22 @@ ELFFile<ELFT>::toMappedAddr(uint64_t VAddr, WarningHandler WarnHandler) const { if (Phdr.p_type == ELF::PT_LOAD) LoadSegments.push_back(const_cast<Elf_Phdr *>(&Phdr)); - auto SortPred = [](const Elf_Phdr_Impl<ELFT> *A, - const Elf_Phdr_Impl<ELFT> *B) { - return A->p_vaddr < B->p_vaddr; - }; - if (!llvm::is_sorted(LoadSegments, SortPred)) { - if (Error E = - WarnHandler("loadable segments are unsorted by virtual address")) - return std::move(E); - llvm::stable_sort(LoadSegments, SortPred); - } - - const Elf_Phdr *const *I = llvm::upper_bound( - LoadSegments, VAddr, [](uint64_t VAddr, const Elf_Phdr_Impl<ELFT> *Phdr) { - return VAddr < Phdr->p_vaddr; - }); - + auto SortPred = [](const Elf_Phdr_Impl<ELFT> *A, + const Elf_Phdr_Impl<ELFT> *B) { + return A->p_vaddr < B->p_vaddr; + }; + if (!llvm::is_sorted(LoadSegments, SortPred)) { + if (Error E = + WarnHandler("loadable segments are unsorted by virtual address")) + return std::move(E); + llvm::stable_sort(LoadSegments, SortPred); + } + + const Elf_Phdr *const *I = llvm::upper_bound( + LoadSegments, VAddr, [](uint64_t VAddr, const Elf_Phdr_Impl<ELFT> *Phdr) { + return VAddr < Phdr->p_vaddr; + }); + if (I == LoadSegments.begin()) return createError("virtual address is not in any segment: 0x" + Twine::utohexstr(VAddr)); |