From: Fangrui Song Date: Mon, 17 Oct 2022 17:08:47 +0000 (-0700) Subject: [ELF] Move PPC64 above. NFC X-Git-Tag: upstream/17.0.6~30345 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ba60576c5b2524f9b94283aaf29475fa2faa54f;p=platform%2Fupstream%2Fllvm.git [ELF] Move PPC64 above. NFC Prepare for a refactoring. --- diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index b33adef..3129546 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -148,6 +148,48 @@ enum class LegacyToPrefixMask : uint64_t { 0x8000000003e00000, // S/T (6-10) - The [S/T]X bit moves from 28 to 5. }; +namespace { +class PPC64 final : public TargetInfo { +public: + PPC64(); + int getTlsGdRelaxSkip(RelType type) const override; + uint32_t calcEFlags() const override; + RelExpr getRelExpr(RelType type, const Symbol &s, + const uint8_t *loc) const override; + RelType getDynRel(RelType type) const override; + int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override; + void writePltHeader(uint8_t *buf) const override; + void writePlt(uint8_t *buf, const Symbol &sym, + uint64_t pltEntryAddr) const override; + void writeIplt(uint8_t *buf, const Symbol &sym, + uint64_t pltEntryAddr) const override; + void relocate(uint8_t *loc, const Relocation &rel, + uint64_t val) const override; + void writeGotHeader(uint8_t *buf) const override; + bool needsThunk(RelExpr expr, RelType type, const InputFile *file, + uint64_t branchAddr, const Symbol &s, + int64_t a) const override; + uint32_t getThunkSectionSpacing() const override; + bool inBranchRange(RelType type, uint64_t src, uint64_t dst) const override; + RelExpr adjustTlsExpr(RelType type, RelExpr expr) const override; + RelExpr adjustGotPcExpr(RelType type, int64_t addend, + const uint8_t *loc) const override; + void relaxGot(uint8_t *loc, const Relocation &rel, + uint64_t val) const override; + void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, + uint64_t val) const override; + void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, + uint64_t val) const override; + void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, + uint64_t val) const override; + void relaxTlsIeToLe(uint8_t *loc, const Relocation &rel, + uint64_t val) const override; + + bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end, + uint8_t stOther) const override; +}; +} // namespace + uint64_t elf::getPPC64TocBase() { // The TOC consists of sections .got, .toc, .tocbss, .plt in that order. The // TOC starts where the first of these sections starts. We always create a @@ -355,48 +397,6 @@ bool elf::tryRelaxPPC64TocIndirection(const Relocation &rel, uint8_t *bufLoc) { return true; } -namespace { -class PPC64 final : public TargetInfo { -public: - PPC64(); - int getTlsGdRelaxSkip(RelType type) const override; - uint32_t calcEFlags() const override; - RelExpr getRelExpr(RelType type, const Symbol &s, - const uint8_t *loc) const override; - RelType getDynRel(RelType type) const override; - int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override; - void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, const Symbol &sym, - uint64_t pltEntryAddr) const override; - void writeIplt(uint8_t *buf, const Symbol &sym, - uint64_t pltEntryAddr) const override; - void relocate(uint8_t *loc, const Relocation &rel, - uint64_t val) const override; - void writeGotHeader(uint8_t *buf) const override; - bool needsThunk(RelExpr expr, RelType type, const InputFile *file, - uint64_t branchAddr, const Symbol &s, - int64_t a) const override; - uint32_t getThunkSectionSpacing() const override; - bool inBranchRange(RelType type, uint64_t src, uint64_t dst) const override; - RelExpr adjustTlsExpr(RelType type, RelExpr expr) const override; - RelExpr adjustGotPcExpr(RelType type, int64_t addend, - const uint8_t *loc) const override; - void relaxGot(uint8_t *loc, const Relocation &rel, - uint64_t val) const override; - void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, - uint64_t val) const override; - void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, - uint64_t val) const override; - void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, - uint64_t val) const override; - void relaxTlsIeToLe(uint8_t *loc, const Relocation &rel, - uint64_t val) const override; - - bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end, - uint8_t stOther) const override; -}; -} // namespace - // Relocation masks following the #lo(value), #hi(value), #ha(value), // #higher(value), #highera(value), #highest(value), and #highesta(value) // macros defined in section 4.5.1. Relocation Types of the PPC-elf64abi