summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86LDBackend.h
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2013-05-03 19:09:24 -0700
committerStephen Hines <srhines@google.com>2013-05-03 19:09:24 -0700
commitf7ac0f19a1c8d0ad14bcf6456ce368b830fea886 (patch)
treed5d6aff551b354ec8f111b55b1df07db01217971 /lib/Target/X86/X86LDBackend.h
parent6f75755c9204b1d8817ae5a65a2f7e5af0ec3f70 (diff)
downloadmclinker-f7ac0f19a1c8d0ad14bcf6456ce368b830fea886.tar.gz
Update mclinker to 96e60abf286338c8e231b7c990c30c7c4651be0e.
Change-Id: I29a840d11cecc1ed133768b79222f8bae5f4db2d
Diffstat (limited to 'lib/Target/X86/X86LDBackend.h')
-rw-r--r--lib/Target/X86/X86LDBackend.h111
1 files changed, 6 insertions, 105 deletions
diff --git a/lib/Target/X86/X86LDBackend.h b/lib/Target/X86/X86LDBackend.h
index a008d00..a3e8635 100644
--- a/lib/Target/X86/X86LDBackend.h
+++ b/lib/Target/X86/X86LDBackend.h
@@ -28,50 +28,6 @@ class GNUInfo;
class X86GNULDBackend : public GNULDBackend
{
public:
- /** \enum ReservedEntryType
- * \brief The reserved entry type of reserved space in ResolveInfo.
- *
- * This is used for sacnRelocation to record what kinds of entries are
- * reserved for this resolved symbol
- *
- * In X86, there are three kinds of entries, GOT, PLT, and dynamic reloction.
- * GOT may needs a corresponding relocation to relocate itself, so we
- * separate GOT to two situations: GOT and GOTRel. Besides, for the same
- * symbol, there might be two kinds of entries reserved for different location.
- * For example, reference to the same symbol, one may use GOT and the other may
- * use dynamic relocation.
- *
- * bit: 3 2 1 0
- * | PLT | GOTRel | GOT | Rel |
- *
- * value Name - Description
- *
- * 0000 None - no reserved entry
- * 0001 ReserveRel - reserve an dynamic relocation entry
- * 0010 ReserveGOT - reserve an GOT entry
- * 0011 GOTandRel - For different relocation, we've reserved GOT and
- * Rel for different location.
- * 0100 GOTRel - reserve an GOT entry and the corresponding Dyncamic
- * relocation entry which relocate this GOT entry
- * 0101 GOTRelandRel - For different relocation, we've reserved GOTRel
- * and relocation entry for different location.
- * 1000 ReservePLT - reserve an PLT entry and the corresponding GOT,
- * Dynamic relocation entries
- * 1001 PLTandRel - For different relocation, we've reserved PLT and
- * Rel for different location.
- */
- enum ReservedEntryType {
- None = 0,
- ReserveRel = 1,
- ReserveGOT = 2,
- GOTandRel = 3,
- GOTRel = 4,
- GOTRelandRel = 5,
- ReservePLT = 8,
- PLTandRel = 9
- };
-
-public:
X86GNULDBackend(const LinkerConfig& pConfig,
GNUInfo* pInfo,
Relocation::Type pCopyRel);
@@ -126,60 +82,31 @@ public:
void initTargetSymbols(IRBuilder& pBuilder, Module& pModule);
- /// scanRelocation - determine the empty entries are needed or not and create
- /// the empty entries if needed.
- /// For X86, following entries are check to create:
- /// - GOT entry (for .got and .got.plt sections)
- /// - PLT entry (for .plt section)
- /// - dynamin relocation entries (for .rel.plt and .rel.dyn sections)
- void scanRelocation(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection);
-
OutputRelocSection& getRelDyn();
-
const OutputRelocSection& getRelDyn() const;
OutputRelocSection& getRelPLT();
-
const OutputRelocSection& getRelPLT() const;
+ LDSymbol* getGOTSymbol() { return m_pGOTSymbol; }
+ const LDSymbol* getGOTSymbol() const { return m_pGOTSymbol; }
+
/// getTargetSectionOrder - compute the layout order of X86 target sections
unsigned int getTargetSectionOrder(const LDSection& pSectHdr) const;
/// finalizeTargetSymbols - finalize the symbol value
bool finalizeTargetSymbols();
- /// getPointerRel - get pointer relocation type.
+ /// getPointerRel - get pointer relocation type.
Relocation::Type getPointerRel()
{ return m_PointerRel; }
-private:
- virtual void scanLocalReloc(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection) = 0;
-
- virtual void scanGlobalReloc(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection) = 0;
+ Relocation::Type getCopyRelType() const { return m_CopyRel; }
+ Relocation::Type getPointerRelType() const { return m_PointerRel; }
protected:
- /// addCopyReloc - add a copy relocation into .rel.dyn for pSym
- /// @param pSym - A resolved copy symbol that defined in BSS section
- void addCopyReloc(ResolveInfo& pSym);
-
- /// defineSymbolforCopyReloc - allocate a space in BSS section and
- /// and force define the copy of pSym to BSS section
- /// @return the output LDSymbol of the copy symbol
- LDSymbol& defineSymbolforCopyReloc(IRBuilder& pLinker,
- const ResolveInfo& pSym);
-
void defineGOTSymbol(IRBuilder& pBuilder, Fragment&);
-protected:
/// getRelEntrySize - the size in BYTE of rel type relocation
size_t getRelEntrySize()
{ return m_RelEntrySize; }
@@ -242,26 +169,10 @@ public:
const X86_32GOTPLT& getGOTPLT() const;
- X86_32GOTEntry& getTLSModuleID();
-
private:
- void scanLocalReloc(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection);
-
- void scanGlobalReloc(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection);
-
/// initRelocator - create and initialize Relocator.
bool initRelocator();
- /// ----- tls optimization ----- ///
- /// convert R_386_TLS_IE to R_386_TLS_LE
- void convertTLSIEtoLE(Relocation& pReloc, LDSection& pSection);
-
void setGOTSectionSize(IRBuilder& pBuilder);
uint64_t emitGOTSectionData(MemoryRegion& pRegion) const;
@@ -299,16 +210,6 @@ public:
const X86_64GOTPLT& getGOTPLT() const;
private:
- void scanLocalReloc(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection);
-
- void scanGlobalReloc(Relocation& pReloc,
- IRBuilder& pBuilder,
- Module& pModule,
- LDSection& pSection);
-
/// initRelocator - create and initialize Relocator.
bool initRelocator();