diff options
author | Stephen Hines <srhines@google.com> | 2014-04-24 14:41:24 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-04-24 15:22:31 -0700 |
commit | 551ae4ebd3e9d137ea668fb83ae4a55b8cfba451 (patch) | |
tree | c4ea60679a6fe2630e21bf6d46177b2c4fcab33b /lib/Target/Hexagon | |
parent | 334c6f83c1265eabd58ac7c8b860898038831eab (diff) | |
download | mclinker-551ae4ebd3e9d137ea668fb83ae4a55b8cfba451.tar.gz |
Update MCLinker for LLVM 3.5.
Change-Id: Ib07513d0eb2f8b7d3516a7dd8823f98820943cc9
Diffstat (limited to 'lib/Target/Hexagon')
-rw-r--r-- | lib/Target/Hexagon/Hexagon.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonAbsoluteStub.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonELFDynamic.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonELFDynamic.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonELFMCLinker.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonEncodings.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonGNUInfo.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonGOT.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonGOTPLT.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonLDBackend.h | 6 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonPLT.cpp | 20 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonPLT.h | 8 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonRelocationFunctions.h | 10 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonRelocator.cpp | 120 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonRelocator.h | 4 | ||||
-rw-r--r-- | lib/Target/Hexagon/HexagonTargetMachine.h | 4 |
16 files changed, 100 insertions, 106 deletions
diff --git a/lib/Target/Hexagon/Hexagon.h b/lib/Target/Hexagon/Hexagon.h index 731a878..437a839 100644 --- a/lib/Target/Hexagon/Hexagon.h +++ b/lib/Target/Hexagon/Hexagon.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_TARGET_HEXAGON_H -#define MCLD_TARGET_HEXAGON_H +#ifndef TARGET_HEXAGON_HEXAGON_H +#define TARGET_HEXAGON_HEXAGON_H #include <string> namespace llvm { diff --git a/lib/Target/Hexagon/HexagonAbsoluteStub.h b/lib/Target/Hexagon/HexagonAbsoluteStub.h index f5a3994..0f86318 100644 --- a/lib/Target/Hexagon/HexagonAbsoluteStub.h +++ b/lib/Target/Hexagon/HexagonAbsoluteStub.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MCLD_HEXAGON_ABSOLUTE_STUB_H -#define MCLD_HEXAGON_ABSOLUTE_STUB_H +#ifndef TARGET_HEXAGON_HEXAGONABSOLUTESTUB_H +#define TARGET_HEXAGON_HEXAGONABSOLUTESTUB_H #ifdef ENABLE_UNITTEST #include <gtest.h> #endif diff --git a/lib/Target/Hexagon/HexagonELFDynamic.cpp b/lib/Target/Hexagon/HexagonELFDynamic.cpp index 96d0946..96534cc 100644 --- a/lib/Target/Hexagon/HexagonELFDynamic.cpp +++ b/lib/Target/Hexagon/HexagonELFDynamic.cpp @@ -32,6 +32,6 @@ void HexagonELFDynamic::applyTargetEntries(const ELFFileFormat& pFormat) { // applyPLTGOT if (pFormat.hasGOTPLT()) - applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOTPLT().addr()); + applyOne(llvm::ELF::DT_PLTGOT, pFormat.getGOTPLT().addr()); } diff --git a/lib/Target/Hexagon/HexagonELFDynamic.h b/lib/Target/Hexagon/HexagonELFDynamic.h index 423d918..092243d 100644 --- a/lib/Target/Hexagon/HexagonELFDynamic.h +++ b/lib/Target/Hexagon/HexagonELFDynamic.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_HEXAGON_ELFDYNAMIC_SECTION_H -#define MCLD_HEXAGON_ELFDYNAMIC_SECTION_H +#ifndef TARGET_HEXAGON_HEXAGONELFDYNAMIC_H +#define TARGET_HEXAGON_HEXAGONELFDYNAMIC_H #ifdef ENABLE_UNITTEST #include <gtest.h> #endif diff --git a/lib/Target/Hexagon/HexagonELFMCLinker.h b/lib/Target/Hexagon/HexagonELFMCLinker.h index 6bbfe26..e7510e0 100644 --- a/lib/Target/Hexagon/HexagonELFMCLinker.h +++ b/lib/Target/Hexagon/HexagonELFMCLinker.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef HEXAGON_ELFSECTLINKER_H -#define HEXAGON_ELFSECTLINKER_H +#ifndef TARGET_HEXAGON_HEXAGONELFMCLINKER_H +#define TARGET_HEXAGON_HEXAGONELFMCLINKER_H #ifdef ENABLE_UNITTEST #include <gtest.h> #endif diff --git a/lib/Target/Hexagon/HexagonEncodings.h b/lib/Target/Hexagon/HexagonEncodings.h index e26f73b..2a2e9db 100644 --- a/lib/Target/Hexagon/HexagonEncodings.h +++ b/lib/Target/Hexagon/HexagonEncodings.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef HEXAGON_ENCODINGS_H -#define HEXAGON_ENCODINGS_H +#ifndef TARGET_HEXAGON_HEXAGONENCODINGS_H +#define TARGET_HEXAGON_HEXAGONENCODINGS_H Instruction insn_encodings[] = { { "if (Pv4) memb(Rs32+#u6:0)=Rt32", diff --git a/lib/Target/Hexagon/HexagonGNUInfo.h b/lib/Target/Hexagon/HexagonGNUInfo.h index d7b471c..0173e65 100644 --- a/lib/Target/Hexagon/HexagonGNUInfo.h +++ b/lib/Target/Hexagon/HexagonGNUInfo.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_TARGET_HEXAGON_GNU_INFO_H -#define MCLD_TARGET_HEXAGON_GNU_INFO_H +#ifndef TARGET_HEXAGON_HEXAGONGNUINFO_H +#define TARGET_HEXAGON_HEXAGONGNUINFO_H #include <mcld/Target/GNUInfo.h> #include <mcld/TargetOptions.h> diff --git a/lib/Target/Hexagon/HexagonGOT.h b/lib/Target/Hexagon/HexagonGOT.h index c29239c..0bde189 100644 --- a/lib/Target/Hexagon/HexagonGOT.h +++ b/lib/Target/Hexagon/HexagonGOT.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_TARGET_HEXAGON_GOT_H -#define MCLD_TARGET_HEXAGON_GOT_H +#ifndef TARGET_HEXAGON_HEXAGONGOT_H +#define TARGET_HEXAGON_HEXAGONGOT_H #ifdef ENABLE_UNITTEST #include <gtest.h> #endif diff --git a/lib/Target/Hexagon/HexagonGOTPLT.h b/lib/Target/Hexagon/HexagonGOTPLT.h index 9fc67cd..a815229 100644 --- a/lib/Target/Hexagon/HexagonGOTPLT.h +++ b/lib/Target/Hexagon/HexagonGOTPLT.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_HEXAGON_GOTPLT_H -#define MCLD_HEXAGON_GOTPLT_H +#ifndef TARGET_HEXAGON_HEXAGONGOTPLT_H +#define TARGET_HEXAGON_HEXAGONGOTPLT_H #ifdef ENABLE_UNITTEST #include <gtest.h> #endif diff --git a/lib/Target/Hexagon/HexagonLDBackend.h b/lib/Target/Hexagon/HexagonLDBackend.h index e2bc2bb..21d2e38 100644 --- a/lib/Target/Hexagon/HexagonLDBackend.h +++ b/lib/Target/Hexagon/HexagonLDBackend.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef HEXAGON_LDBACKEND_H -#define HEXAGON_LDBACKEND_H +#ifndef TARGET_HEXAGON_HEXAGONLDBACKEND_H +#define TARGET_HEXAGON_HEXAGONLDBACKEND_H #include "HexagonELFDynamic.h" #include "HexagonGOT.h" @@ -169,7 +169,7 @@ private: virtual uint64_t emitGOTSectionData(MemoryRegion& pRegion) const; virtual uint64_t emitGOTPLTSectionData(MemoryRegion& pRegion, - const ELFFileFormat* FileFormat) const; + const ELFFileFormat* FileFormat) const; virtual void setRelaDynSize(); virtual void setRelaPLTSize(); diff --git a/lib/Target/Hexagon/HexagonPLT.cpp b/lib/Target/Hexagon/HexagonPLT.cpp index 6309408..3d692fd 100644 --- a/lib/Target/Hexagon/HexagonPLT.cpp +++ b/lib/Target/Hexagon/HexagonPLT.cpp @@ -48,7 +48,7 @@ HexagonPLT::HexagonPLT(LDSection& pSection, m_PLT0 = hexagon_plt0; m_PLT0Size = sizeof (hexagon_plt0); // create PLT0 - new HexagonPLT0(*m_SectionData); + new HexagonPLT0(*m_pSectionData); pSection.setAlign(16); } @@ -58,9 +58,9 @@ HexagonPLT::~HexagonPLT() PLTEntryBase* HexagonPLT::getPLT0() const { - iterator first = m_SectionData->getFragmentList().begin(); + iterator first = m_pSectionData->getFragmentList().begin(); - assert(first != m_SectionData->getFragmentList().end() && + assert(first != m_pSectionData->getFragmentList().end() && "FragmentList is empty, getPLT0 failed!"); PLTEntryBase* plt0 = &(llvm::cast<PLTEntryBase>(*first)); @@ -80,13 +80,13 @@ void HexagonPLT::finalizeSectionSize() if (end() != it) { // plt1 size PLTEntryBase* plt1 = &(llvm::cast<PLTEntryBase>(*it)); - size += (m_SectionData->size() - 1) * plt1->size(); + size += (m_pSectionData->size() - 1) * plt1->size(); } m_Section.setSize(size); uint32_t offset = 0; - SectionData::iterator frag, fragEnd = m_SectionData->end(); - for (frag = m_SectionData->begin(); frag != fragEnd; ++frag) { + SectionData::iterator frag, fragEnd = m_pSectionData->end(); + for (frag = m_pSectionData->begin(); frag != fragEnd; ++frag) { frag->setOffset(offset); offset += frag->size(); } @@ -94,12 +94,12 @@ void HexagonPLT::finalizeSectionSize() bool HexagonPLT::hasPLT1() const { - return (m_SectionData->size() > 1); + return (m_pSectionData->size() > 1); } HexagonPLT1* HexagonPLT::create() { - return new HexagonPLT1(*m_SectionData); + return new HexagonPLT1(*m_pSectionData); } void HexagonPLT::applyPLT0() @@ -135,8 +135,8 @@ void HexagonPLT::applyPLT1() { uint64_t got_base = m_GOTPLT.addr(); assert(got_base && ".got base address is NULL!"); - HexagonPLT::iterator it = m_SectionData->begin(); - HexagonPLT::iterator ie = m_SectionData->end(); + HexagonPLT::iterator it = m_pSectionData->begin(); + HexagonPLT::iterator ie = m_pSectionData->end(); assert(it != ie && "FragmentList is empty, applyPLT1 failed!"); uint32_t GOTEntrySize = HexagonGOTEntry::EntrySize; diff --git a/lib/Target/Hexagon/HexagonPLT.h b/lib/Target/Hexagon/HexagonPLT.h index abdb4ea..4acce49 100644 --- a/lib/Target/Hexagon/HexagonPLT.h +++ b/lib/Target/Hexagon/HexagonPLT.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_TARGET_HEXAGON_PLT_H -#define MCLD_TARGET_HEXAGON_PLT_H +#ifndef TARGET_HEXAGON_HEXAGONPLT_H +#define TARGET_HEXAGON_HEXAGONPLT_H #include "HexagonGOT.h" #include "HexagonGOTPLT.h" @@ -29,14 +29,14 @@ const uint8_t hexagon_plt0[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; const uint8_t hexagon_plt1[] = { 0x00, 0x40, 0x00, 0x00, // { immext (#0) 0x0e, 0xc0, 0x49, 0x6a, // r14 = add (pc, ##GOTn@PCREL) } # address of GOTn 0x1c, 0xc0, 0x8e, 0x91, // r28 = memw (r14) # contents of GOTn - 0x00, 0xc0, 0x9c, 0x52, // jumpr r28 # call it + 0x00, 0xc0, 0x9c, 0x52 // jumpr r28 # call it }; } // anonymous namespace diff --git a/lib/Target/Hexagon/HexagonRelocationFunctions.h b/lib/Target/Hexagon/HexagonRelocationFunctions.h index 6f9acad..6c60954 100644 --- a/lib/Target/Hexagon/HexagonRelocationFunctions.h +++ b/lib/Target/Hexagon/HexagonRelocationFunctions.h @@ -7,11 +7,11 @@ // //===----------------------------------------------------------------------===// typedef struct { - const char *insnSyntax; - uint32_t insnMask; - uint32_t insnCmpMask; - uint32_t insnBitMask; - bool isDuplex; + const char *insnSyntax; + uint32_t insnMask; + uint32_t insnCmpMask; + uint32_t insnBitMask; + bool isDuplex; } Instruction; //===--------------------------------------------------------------------===// diff --git a/lib/Target/Hexagon/HexagonRelocator.cpp b/lib/Target/Hexagon/HexagonRelocator.cpp index b82bbcd..d02b640 100644 --- a/lib/Target/Hexagon/HexagonRelocator.cpp +++ b/lib/Target/Hexagon/HexagonRelocator.cpp @@ -26,7 +26,7 @@ using namespace mcld; static Relocation &helper_DynRel_init(ResolveInfo *pSym, Fragment &pFrag, uint64_t pOffset, - HexagonRelocator::Type pType, + Relocator::Type pType, HexagonRelocator &pParent) { HexagonLDBackend &ld_backend = pParent.getTarget(); Relocation &rela_entry = *ld_backend.getRelaDyn().create(); @@ -82,7 +82,7 @@ static HexagonGOTEntry &helper_GOT_init(Relocation &pReloc, return *got_entry; } -static HexagonRelocator::Address helper_get_GOT_address(ResolveInfo &pSym, +static Relocator::Address helper_get_GOT_address(ResolveInfo &pSym, HexagonRelocator &pParent) { HexagonGOTEntry *got_entry = pParent.getSymGOTMap().lookUp(pSym); assert(NULL != got_entry); @@ -112,7 +112,7 @@ static PLTEntryBase &helper_PLT_init(Relocation &pReloc, return *plt_entry; } -static HexagonRelocator::Address helper_get_PLT_address(ResolveInfo& pSym, +static Relocator::Address helper_get_PLT_address(ResolveInfo& pSym, HexagonRelocator &pParent) { PLTEntryBase *plt_entry = pParent.getSymPLTMap().lookUp(pSym); assert(NULL != plt_entry); @@ -124,9 +124,9 @@ static HexagonRelocator::Address helper_get_PLT_address(ResolveInfo& pSym, //===--------------------------------------------------------------------===// DECL_HEXAGON_APPLY_RELOC_FUNCS - /// the prototype of applying function - typedef Relocator::Result (*ApplyFunctionType)(Relocation &pReloc, - HexagonRelocator &pParent); +/// the prototype of applying function +typedef Relocator::Result (*ApplyFunctionType)(Relocation &pReloc, + HexagonRelocator &pParent); // the table entry of applying functions struct ApplyFunctionTriple { @@ -480,16 +480,16 @@ void HexagonRelocator::partialScanRelocation(Relocation &pReloc, //=========================================// // R_HEX_NONE -HexagonRelocator::Result none(Relocation &pReloc, HexagonRelocator &pParent) { - return HexagonRelocator::OK; +Relocator::Result none(Relocation &pReloc, HexagonRelocator &pParent) { + return Relocator::OK; } //R_HEX_32 and its class of relocations use only addend and symbol value // S + A : result is unsigned truncate. // Exception: R_HEX_32_6_X : unsigned verify -HexagonRelocator::Result applyAbs(Relocation &pReloc) { - HexagonRelocator::Address S = pReloc.symValue(); - HexagonRelocator::DWord A = pReloc.addend(); +Relocator::Result applyAbs(Relocation &pReloc) { + Relocator::Address S = pReloc.symValue(); + Relocator::DWord A = pReloc.addend(); uint32_t result = (uint32_t)(S + A); uint32_t bitMask = 0; uint32_t effectiveBits = 0; @@ -548,25 +548,25 @@ HexagonRelocator::Result applyAbs(Relocation &pReloc) { } if ((shift != 0) && (result % alignment != 0)) - return HexagonRelocator::BadReloc; + return Relocator::BadReloc; result >>= shift; if (effectiveBits) { uint32_t range = 1 << effectiveBits; if (result > (range - 1)) - return HexagonRelocator::Overflow; + return Relocator::Overflow; } pReloc.target() |= ApplyMask<uint32_t>(bitMask, result); - return HexagonRelocator::OK; + return Relocator::OK; } //R_HEX_B22_PCREL and its class of relocations, use // S + A - P : result is signed verify. // Exception: R_HEX_B32_PCREL_X : signed truncate // Another Exception: R_HEX_6_PCREL_X is unsigned truncate -HexagonRelocator::Result applyRel(Relocation &pReloc, int64_t pResult) { +Relocator::Result applyRel(Relocation &pReloc, int64_t pResult) { uint32_t bitMask = 0; uint32_t effectiveBits = 0; uint32_t alignment = 1; @@ -654,7 +654,7 @@ HexagonRelocator::Result applyRel(Relocation &pReloc, int64_t pResult) { bitMask = FINDBITMASK(pReloc.target()); result = pReloc.addend() + pReloc.symValue() - pReloc.place(); pReloc.target() |= ApplyMask<uint32_t>(bitMask, result); - return HexagonRelocator::OK; + return Relocator::OK; default: // show proper error @@ -663,25 +663,24 @@ HexagonRelocator::Result applyRel(Relocation &pReloc, int64_t pResult) { } if ((shift != 0) && (pResult % alignment != 0)) - return HexagonRelocator::BadReloc; + return Relocator::BadReloc; pResult >>= shift; if (effectiveBits) { int64_t range = 1LL << (effectiveBits - 1); if ((pResult > (range - 1)) || (pResult < -range)) - return HexagonRelocator::Overflow; + return Relocator::Overflow; } pReloc.target() |= (uint32_t) ApplyMask<int32_t>(bitMask, pResult); - return HexagonRelocator::OK; + return Relocator::OK; } -HexagonRelocator::Result relocAbs(Relocation &pReloc, - HexagonRelocator &pParent) { +Relocator::Result relocAbs(Relocation &pReloc, HexagonRelocator &pParent) { ResolveInfo *rsym = pReloc.symInfo(); - HexagonRelocator::Address S = pReloc.symValue(); - HexagonRelocator::DWord A = pReloc.addend(); + Relocator::Address S = pReloc.symValue(); + Relocator::DWord A = pReloc.addend(); Relocation* rel_entry = pParent.getRelRelMap().lookUp(pReloc); bool has_dyn_rel = (NULL != rel_entry); @@ -696,7 +695,7 @@ HexagonRelocator::Result relocAbs(Relocation &pReloc, // a local symbol with .rela type relocation if (rsym->isLocal() && has_dyn_rel) { rel_entry->setAddend(S + A); - return HexagonRelocator::OK; + return Relocator::OK; } if (!rsym->isLocal()) { @@ -710,7 +709,7 @@ HexagonRelocator::Result relocAbs(Relocation &pReloc, rel_entry->setAddend(S + A); } else { rel_entry->setAddend(A); - return HexagonRelocator::OK; + return Relocator::OK; } } } @@ -718,14 +717,13 @@ HexagonRelocator::Result relocAbs(Relocation &pReloc, return applyAbs(pReloc); } -HexagonRelocator::Result relocPCREL(Relocation &pReloc, - HexagonRelocator &pParent) { +Relocator::Result relocPCREL(Relocation &pReloc, HexagonRelocator &pParent) { ResolveInfo *rsym = pReloc.symInfo(); int64_t result; - HexagonRelocator::Address S = pReloc.symValue(); - HexagonRelocator::DWord A = pReloc.addend(); - HexagonRelocator::DWord P = pReloc.place(); + Relocator::Address S = pReloc.symValue(); + Relocator::DWord A = pReloc.addend(); + Relocator::DWord P = pReloc.place(); FragmentRef &target_fragref = pReloc.targetRef(); Fragment *target_frag = target_fragref.frag(); @@ -743,7 +741,7 @@ HexagonRelocator::Result relocPCREL(Relocation &pReloc, S = helper_get_PLT_address(*rsym, pParent); result = (int64_t)(S + A - P); applyRel(pReloc, result); - return HexagonRelocator::OK; + return Relocator::OK; } } @@ -751,11 +749,10 @@ HexagonRelocator::Result relocPCREL(Relocation &pReloc, } // R_HEX_GPREL16_0 and its class : Unsigned Verify -HexagonRelocator::Result relocGPREL(Relocation &pReloc, - HexagonRelocator &pParent) { - HexagonRelocator::Address S = pReloc.symValue(); - HexagonRelocator::DWord A = pReloc.addend(); - HexagonRelocator::DWord GP = pParent.getTarget().getGP(); +Relocator::Result relocGPREL(Relocation &pReloc, HexagonRelocator &pParent) { + Relocator::Address S = pReloc.symValue(); + Relocator::DWord A = pReloc.addend(); + Relocator::DWord GP = pParent.getTarget().getGP(); uint32_t result = (uint32_t)(S + A - GP); uint32_t shift = 0; @@ -790,40 +787,39 @@ HexagonRelocator::Result relocGPREL(Relocation &pReloc, uint32_t bitMask = FINDBITMASK(pReloc.target()); if ((shift != 0) && (result % alignment != 0)) - return HexagonRelocator::BadReloc; + return Relocator::BadReloc; result >>= shift; if (result < range - 1) { pReloc.target() |= ApplyMask<uint32_t>(bitMask, result); - return HexagonRelocator::OK; + return Relocator::OK; } - return HexagonRelocator::Overflow; + return Relocator::Overflow; } // R_HEX_PLT_B22_PCREL: PLT(S) + A - P -HexagonRelocator::Result relocPLTB22PCREL(Relocation &pReloc, - HexagonRelocator &pParent) { +Relocator::Result relocPLTB22PCREL(Relocation &pReloc, + HexagonRelocator &pParent) { // PLT_S depends on if there is a PLT entry. - HexagonRelocator::Address PLT_S; + Relocator::Address PLT_S; if ((pReloc.symInfo()->reserved() & HexagonRelocator::ReservePLT)) PLT_S = helper_get_PLT_address(*pReloc.symInfo(), pParent); else PLT_S = pReloc.symValue(); - HexagonRelocator::Address P = pReloc.place(); + Relocator::Address P = pReloc.place(); uint32_t bitMask = FINDBITMASK(pReloc.target()); uint32_t result = (PLT_S + pReloc.addend() - P) >> 2; pReloc.target() = pReloc.target() | ApplyMask<uint32_t>(bitMask, result); - return HexagonRelocator::OK; + return Relocator::OK; } //R_HEX_GOT_LO16 and its class : (G) Signed Truncate //Exception: R_HEX_GOT_16(_X): signed verify // Exception: R_HEX_GOT_11_X : unsigned truncate -HexagonRelocator::Result relocGOT(Relocation &pReloc, - HexagonRelocator &pParent) { +Relocator::Result relocGOT(Relocation &pReloc, HexagonRelocator &pParent) { if (!(pReloc.symInfo()->reserved() & HexagonRelocator::ReserveGOT)) { - return HexagonRelocator::BadReloc; + return Relocator::BadReloc; } // set got entry value if needed @@ -832,9 +828,9 @@ HexagonRelocator::Result relocGOT(Relocation &pReloc, if (HexagonRelocator::SymVal == got_entry->getValue()) got_entry->setValue(pReloc.symValue()); - HexagonRelocator::Address GOT_S = + Relocator::Address GOT_S = helper_get_GOT_address(*pReloc.symInfo(), pParent); - HexagonRelocator::Address GOT = pParent.getTarget().getGOTSymbolAddr(); + Relocator::Address GOT = pParent.getTarget().getGOTSymbolAddr(); int32_t result = (int32_t)(GOT_S - GOT); uint32_t effectiveBits = 0; uint32_t alignment = 1; @@ -876,7 +872,7 @@ HexagonRelocator::Result relocGOT(Relocation &pReloc, bitMask = FINDBITMASK(pReloc.target()); result_u = GOT_S - GOT; pReloc.target() |= ApplyMask<uint32_t>(bitMask, result_u); - return HexagonRelocator::OK; + return Relocator::OK; default: // show proper error @@ -885,26 +881,25 @@ HexagonRelocator::Result relocGOT(Relocation &pReloc, } if ((shift != 0) && (result % alignment != 0)) - return HexagonRelocator::BadReloc; + return Relocator::BadReloc; result >>= shift; if (effectiveBits) { int32_t range = 1 << (effectiveBits - 1); if ((result > range - 1) || (result < -range)) - return HexagonRelocator::Overflow; + return Relocator::Overflow; } pReloc.target() |= ApplyMask<int32_t>(bitMask, result); - return HexagonRelocator::OK; + return Relocator::OK; } // R_HEX_GOTREL_LO16: and its class of relocs // (S + A - GOT) : Signed Truncate -HexagonRelocator::Result relocGOTREL(Relocation &pReloc, - HexagonRelocator &pParent) { - HexagonRelocator::Address S = pReloc.symValue(); - HexagonRelocator::DWord A = pReloc.addend(); - HexagonRelocator::Address GOT = pParent.getTarget().getGOTSymbolAddr(); +Relocator::Result relocGOTREL(Relocation &pReloc, HexagonRelocator &pParent) { + Relocator::Address S = pReloc.symValue(); + Relocator::DWord A = pReloc.addend(); + Relocator::Address GOT = pParent.getTarget().getGOTSymbolAddr(); uint32_t bitMask = 0; uint32_t alignment = 1; @@ -944,15 +939,14 @@ HexagonRelocator::Result relocGOTREL(Relocation &pReloc, } if (result % alignment != 0) - return HexagonRelocator::BadReloc; + return Relocator::BadReloc; result >>= shift; pReloc.target() |= ApplyMask<uint32_t>(bitMask, result); - return HexagonRelocator::OK; + return Relocator::OK; } -HexagonRelocator::Result unsupport(Relocation &pReloc, - HexagonRelocator &pParent) { - return HexagonRelocator::Unsupport; +Relocator::Result unsupport(Relocation &pReloc, HexagonRelocator &pParent) { + return Relocator::Unsupport; } diff --git a/lib/Target/Hexagon/HexagonRelocator.h b/lib/Target/Hexagon/HexagonRelocator.h index 02e99c9..79e66eb 100644 --- a/lib/Target/Hexagon/HexagonRelocator.h +++ b/lib/Target/Hexagon/HexagonRelocator.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef HEXAGON_RELOCATION_FACTORY_H -#define HEXAGON_RELOCATION_FACTORY_H +#ifndef TARGET_HEXAGON_HEXAGONRELOCATOR_H +#define TARGET_HEXAGON_HEXAGONRELOCATOR_H #ifdef ENABLE_UNITTEST #include <gtest.h> #endif diff --git a/lib/Target/Hexagon/HexagonTargetMachine.h b/lib/Target/Hexagon/HexagonTargetMachine.h index 9b131c1..5ebf434 100644 --- a/lib/Target/Hexagon/HexagonTargetMachine.h +++ b/lib/Target/Hexagon/HexagonTargetMachine.h @@ -6,8 +6,8 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef MCLD_HEXAGON_TARGET_MACHINE_H -#define MCLD_HEXAGON_TARGET_MACHINE_H +#ifndef TARGET_HEXAGON_HEXAGONTARGETMACHINE_H +#define TARGET_HEXAGON_HEXAGONTARGETMACHINE_H #include "Hexagon.h" #include <mcld/CodeGen/TargetMachine.h> |