diff options
author | Diana Chen <mysekki@gmail.com> | 2014-10-02 15:08:06 +0800 |
---|---|---|
committer | Diana Chen <mysekki@gmail.com> | 2014-10-02 15:22:37 +0800 |
commit | 4b1f659355f4535f1f2924260737ac619a461ed3 (patch) | |
tree | 953602110f6ea3011e562951f597f2d60f616d0c | |
parent | 75c11ff58850a62d272d074cd02c5af7ca544ee0 (diff) | |
download | mclinker-4b1f659355f4535f1f2924260737ac619a461ed3.tar.gz |
lint: Fix style for backend Relocators
-rw-r--r-- | include/mcld/LD/LDSection.h | 2 | ||||
-rw-r--r-- | include/mcld/LD/Relocator.h | 4 | ||||
-rw-r--r-- | lib/Core/IRBuilder.cpp | 3 | ||||
-rw-r--r-- | lib/Object/ObjectLinker.cpp | 7 | ||||
-rw-r--r-- | lib/Target/AArch64/AArch64Relocator.cpp | 13 | ||||
-rw-r--r-- | lib/Target/AArch64/AArch64Relocator.h | 2 | ||||
-rw-r--r-- | lib/Target/ARM/ARMRelocator.cpp | 14 | ||||
-rw-r--r-- | lib/Target/ARM/ARMRelocator.h | 2 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonRelocator.h | 2 | ||||
-rw-r--r-- | lib/Target/Mips/MipsRelocator.cpp | 12 | ||||
-rw-r--r-- | lib/Target/Mips/MipsRelocator.h | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86Relocator.cpp | 26 | ||||
-rw-r--r-- | lib/Target/X86/X86Relocator.h | 4 |
13 files changed, 44 insertions, 49 deletions
diff --git a/include/mcld/LD/LDSection.h b/include/mcld/LD/LDSection.h index c77a31b6..a6078738 100644 --- a/include/mcld/LD/LDSection.h +++ b/include/mcld/LD/LDSection.h @@ -170,7 +170,7 @@ class LDSection { void setIndex(size_t pIndex) { m_Index = pIndex; } -private: + private: union Data { SectionData* sect_data; RelocData* reloc_data; diff --git a/include/mcld/LD/Relocator.h b/include/mcld/LD/Relocator.h index 62a529c4..497d55fc 100644 --- a/include/mcld/LD/Relocator.h +++ b/include/mcld/LD/Relocator.h @@ -117,10 +117,10 @@ class Relocator { /// This is used to set the debug string offset. virtual void applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset) = 0; -protected: + protected: const LinkerConfig& config() const { return m_Config; } -private: + private: const LinkerConfig& m_Config; }; diff --git a/lib/Core/IRBuilder.cpp b/lib/Core/IRBuilder.cpp index 910d6aa9..cba42efb 100644 --- a/lib/Core/IRBuilder.cpp +++ b/lib/Core/IRBuilder.cpp @@ -308,8 +308,7 @@ EhFrame* IRBuilder::CreateEhFrame(LDSection& pSection) { } /// CreateDebugString - To create a DebugString for given pSection -DebugString* IRBuilder::CreateDebugString(LDSection& pSection) -{ +DebugString* IRBuilder::CreateDebugString(LDSection& pSection) { assert(!pSection.hasDebugString() && "pSection already has debug_str."); DebugString* debug_str = DebugString::Create(pSection); diff --git a/lib/Object/ObjectLinker.cpp b/lib/Object/ObjectLinker.cpp index 7a77a514..e5bcb9af 100644 --- a/lib/Object/ObjectLinker.cpp +++ b/lib/Object/ObjectLinker.cpp @@ -791,9 +791,10 @@ bool ObjectLinker::relocation() { // apply the relocation aginst symbol on DebugString if (info->outSymbol()->hasFragRef() && - info->outSymbol()->fragRef()->frag()->getKind() == Fragment::Region && - info->outSymbol()->fragRef()->frag()->getParent()->getSection().kind() == - LDFileFormat::DebugString) { + info->outSymbol()->fragRef()->frag()->getKind() + == Fragment::Region && + info->outSymbol()->fragRef()->frag()->getParent()->getSection() + .kind() == LDFileFormat::DebugString) { assert(debug_str_sect != NULL); assert(debug_str_sect->hasDebugString()); debug_str_sect->getDebugString()->applyOffset(*relocation, diff --git a/lib/Target/AArch64/AArch64Relocator.cpp b/lib/Target/AArch64/AArch64Relocator.cpp index 7c277be5..0458b2b3 100644 --- a/lib/Target/AArch64/AArch64Relocator.cpp +++ b/lib/Target/AArch64/AArch64Relocator.cpp @@ -397,21 +397,20 @@ void AArch64Relocator::scanRelocation(Relocation& pReloc, issueUndefRef(pReloc, pSection, pInput); } -uint32_t AArch64Relocator::getDebugStringOffset(Relocation& pReloc) const -{ +uint32_t AArch64Relocator::getDebugStringOffset(Relocation& pReloc) const { if (pReloc.type() != llvm::ELF::R_AARCH64_ABS32) - error(diag::unsupport_reloc_for_debug_string) << getName(pReloc.type()) - << "mclinker@googlegroups.com"; + error(diag::unsupport_reloc_for_debug_string) + << getName(pReloc.type()) << "mclinker@googlegroups.com"; + if (pReloc.symInfo()->type() == ResolveInfo::Section) return pReloc.target(); else return pReloc.symInfo()->outSymbol()->fragRef()->offset() + - pReloc.target() + pReloc.addend(); + pReloc.target() + pReloc.addend(); } void AArch64Relocator::applyDebugStringOffset(Relocation& pReloc, - uint32_t pOffset) -{ + uint32_t pOffset) { pReloc.target() = pOffset; } diff --git a/lib/Target/AArch64/AArch64Relocator.h b/lib/Target/AArch64/AArch64Relocator.h index 1b97765b..46931a9c 100644 --- a/lib/Target/AArch64/AArch64Relocator.h +++ b/lib/Target/AArch64/AArch64Relocator.h @@ -119,7 +119,7 @@ class AArch64Relocator : public Relocator { /// This is used to set the debug string offset. void applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset); -private: + private: void scanLocalReloc(Relocation& pReloc, const LDSection& pSection); void scanGlobalReloc(Relocation& pReloc, diff --git a/lib/Target/ARM/ARMRelocator.cpp b/lib/Target/ARM/ARMRelocator.cpp index 1dc05e5b..d3e358a6 100644 --- a/lib/Target/ARM/ARMRelocator.cpp +++ b/lib/Target/ARM/ARMRelocator.cpp @@ -757,20 +757,20 @@ void ARMRelocator::scanRelocation(Relocation& pReloc, issueUndefRef(pReloc, pSection, pInput); } -uint32_t ARMRelocator::getDebugStringOffset(Relocation& pReloc) const -{ +uint32_t ARMRelocator::getDebugStringOffset(Relocation& pReloc) const { if (pReloc.type() != llvm::ELF::R_ARM_ABS32) - error(diag::unsupport_reloc_for_debug_string) << getName(pReloc.type()) - << "mclinker@googlegroups.com"; + error(diag::unsupport_reloc_for_debug_string) + << getName(pReloc.type()) << "mclinker@googlegroups.com"; + if (pReloc.symInfo()->type() == ResolveInfo::Section) return pReloc.target(); else return pReloc.symInfo()->outSymbol()->fragRef()->offset() + - pReloc.target() + pReloc.addend(); + pReloc.target() + pReloc.addend(); } -void ARMRelocator::applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset) -{ +void ARMRelocator::applyDebugStringOffset(Relocation& pReloc, + uint32_t pOffset) { pReloc.target() = pOffset; } diff --git a/lib/Target/ARM/ARMRelocator.h b/lib/Target/ARM/ARMRelocator.h index 37ca0f04..597d5631 100644 --- a/lib/Target/ARM/ARMRelocator.h +++ b/lib/Target/ARM/ARMRelocator.h @@ -104,7 +104,7 @@ class ARMRelocator : public Relocator { /// This is used to set the debug string offset. void applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset); -private: + private: void scanLocalReloc(Relocation& pReloc, const LDSection& pSection); void scanGlobalReloc(Relocation& pReloc, diff --git a/lib/Target/Hexagon/HexagonRelocator.h b/lib/Target/Hexagon/HexagonRelocator.h index 9f6bae79..1136edb5 100644 --- a/lib/Target/Hexagon/HexagonRelocator.h +++ b/lib/Target/Hexagon/HexagonRelocator.h @@ -114,7 +114,7 @@ class HexagonRelocator : public Relocator { /// This is used to set the debug string offset. void applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset) {} -protected: + protected: /// addCopyReloc - add a copy relocation into .rela.dyn for pSym /// @param pSym - A resolved copy symbol that defined in BSS section void addCopyReloc(ResolveInfo& pSym, HexagonLDBackend& pTarget); diff --git a/lib/Target/Mips/MipsRelocator.cpp b/lib/Target/Mips/MipsRelocator.cpp index 0067572b..50d32419 100644 --- a/lib/Target/Mips/MipsRelocator.cpp +++ b/lib/Target/Mips/MipsRelocator.cpp @@ -682,21 +682,19 @@ uint64_t MipsRelocator::getPLTAddress(ResolveInfo& rsym) { return getTarget().getPLT().addr() + plt->getOffset(); } -uint32_t MipsRelocator::getDebugStringOffset(Relocation& pReloc) const -{ +uint32_t MipsRelocator::getDebugStringOffset(Relocation& pReloc) const { if (pReloc.type() != llvm::ELF::R_MIPS_32) - error(diag::unsupport_reloc_for_debug_string) << getName(pReloc.type()) - << "mclinker@googlegroups.com"; + error(diag::unsupport_reloc_for_debug_string) + << getName(pReloc.type()) << "mclinker@googlegroups.com"; if (pReloc.symInfo()->type() == ResolveInfo::Section) return pReloc.target(); else return pReloc.symInfo()->outSymbol()->fragRef()->offset() + - pReloc.target() + pReloc.addend(); + pReloc.target() + pReloc.addend(); } void MipsRelocator::applyDebugStringOffset(Relocation& pReloc, - uint32_t pOffset) -{ + uint32_t pOffset) { pReloc.target() = pOffset; } diff --git a/lib/Target/Mips/MipsRelocator.h b/lib/Target/Mips/MipsRelocator.h index 97f19a58..be3b3985 100644 --- a/lib/Target/Mips/MipsRelocator.h +++ b/lib/Target/Mips/MipsRelocator.h @@ -176,7 +176,7 @@ class Mips32Relocator : public MipsRelocator { public: Mips32Relocator(Mips32GNULDBackend& pParent, const LinkerConfig& pConfig); -private: + private: // MipsRelocator void setupRelDynEntry(FragmentRef& pFragRef, ResolveInfo* pSym); }; diff --git a/lib/Target/X86/X86Relocator.cpp b/lib/Target/X86/X86Relocator.cpp index 9ce1c09f..05198ccc 100644 --- a/lib/Target/X86/X86Relocator.cpp +++ b/lib/Target/X86/X86Relocator.cpp @@ -830,21 +830,20 @@ void X86_32Relocator::convertTLSIEtoLE(Relocation& pReloc, pReloc.setType(llvm::ELF::R_386_TLS_LE); } -uint32_t X86_32Relocator::getDebugStringOffset(Relocation& pReloc) const -{ +uint32_t X86_32Relocator::getDebugStringOffset(Relocation& pReloc) const { if (pReloc.type() != llvm::ELF::R_386_32) - error(diag::unsupport_reloc_for_debug_string) << getName(pReloc.type()) - << "mclinker@googlegroups.com"; + error(diag::unsupport_reloc_for_debug_string) + << getName(pReloc.type()) << "mclinker@googlegroups.com"; + if (pReloc.symInfo()->type() == ResolveInfo::Section) return pReloc.target(); else return pReloc.symInfo()->outSymbol()->fragRef()->offset() + - pReloc.target() + pReloc.addend(); + pReloc.target() + pReloc.addend(); } void X86_32Relocator::applyDebugStringOffset(Relocation& pReloc, - uint32_t pOffset) -{ + uint32_t pOffset) { pReloc.target() = pOffset; } @@ -1500,21 +1499,20 @@ void X86_64Relocator::scanGlobalReloc(Relocation& pReloc, } // end switch } -uint32_t X86_64Relocator::getDebugStringOffset(Relocation& pReloc) const -{ +uint32_t X86_64Relocator::getDebugStringOffset(Relocation& pReloc) const { if (pReloc.type() != llvm::ELF::R_X86_64_32) - error(diag::unsupport_reloc_for_debug_string) << getName(pReloc.type()) - << "mclinker@googlegroups.com"; + error(diag::unsupport_reloc_for_debug_string) + << getName(pReloc.type()) << "mclinker@googlegroups.com"; + if (pReloc.symInfo()->type() == ResolveInfo::Section) return pReloc.target(); else return pReloc.symInfo()->outSymbol()->fragRef()->offset() + - pReloc.target() + pReloc.addend(); + pReloc.target() + pReloc.addend(); } void X86_64Relocator::applyDebugStringOffset(Relocation& pReloc, - uint32_t pOffset) -{ + uint32_t pOffset) { pReloc.target() = pOffset; } diff --git a/lib/Target/X86/X86Relocator.h b/lib/Target/X86/X86Relocator.h index 3c6ce7e0..06c401d2 100644 --- a/lib/Target/X86/X86Relocator.h +++ b/lib/Target/X86/X86Relocator.h @@ -156,7 +156,7 @@ class X86_32Relocator : public X86Relocator { /// This is used to set the debug string offset. void applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset); -private: + private: void scanLocalReloc(Relocation& pReloc, IRBuilder& pBuilder, Module& pModule, @@ -221,7 +221,7 @@ class X86_64Relocator : public X86Relocator { /// This is used to set the debug string offset. void applyDebugStringOffset(Relocation& pReloc, uint32_t pOffset); -private: + private: void scanLocalReloc(Relocation& pReloc, IRBuilder& pBuilder, Module& pModule, |