[llvm-commits] [llvm] r147053 - in /llvm/trunk/lib/MC: ELFObjectWriter.cpp ELFObjectWriter.h
Rafael Espindola
rafael.espindola at gmail.com
Wed Dec 21 06:26:30 PST 2011
Author: rafael
Date: Wed Dec 21 08:26:29 2011
New Revision: 147053
URL: http://llvm.org/viewvc/llvm-project?rev=147053&view=rev
Log:
Small refactoring so that RelocNeedsGOT can stay in the target independent
side when the target specific bits are moved to the Target directory.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/ELFObjectWriter.h
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=147053&r1=147052&r2=147053&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Dec 21 08:26:29 2011
@@ -447,6 +447,10 @@
FixedValue = Value;
unsigned Type = GetRelocType(Target, Fixup, IsPCRel,
(RelocSymbol != 0), Addend);
+ MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
+ MCSymbolRefExpr::VK_None : Target.getSymA()->getKind();
+ if (RelocNeedsGOT(Modifier))
+ NeedsGOT = true;
uint64_t RelocOffset = Layout.getFragmentOffset(Fragment) +
Fixup.getOffset();
@@ -1385,16 +1389,8 @@
const MCFixup &Fixup,
bool IsPCRel,
bool IsRelocWithSymbol,
- int64_t Addend) {
- MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
- MCSymbolRefExpr::VK_None : Target.getSymA()->getKind();
-
- unsigned Type = GetRelocTypeInner(Target, Fixup, IsPCRel);
-
- if (RelocNeedsGOT(Modifier))
- NeedsGOT = true;
-
- return Type;
+ int64_t Addend) const {
+ return GetRelocTypeInner(Target, Fixup, IsPCRel);
}
unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
@@ -1536,7 +1532,7 @@
const MCFixup &Fixup,
bool IsPCRel,
bool IsRelocWithSymbol,
- int64_t Addend) {
+ int64_t Addend) const {
// determine the type of the relocation
unsigned Type;
if (IsPCRel) {
@@ -1606,7 +1602,7 @@
const MCFixup &Fixup,
bool IsPCRel,
bool IsRelocWithSymbol,
- int64_t Addend) {
+ int64_t Addend) const {
// determine the type of the relocation
unsigned Type;
if (IsPCRel) {
@@ -1652,7 +1648,7 @@
const MCFixup &Fixup,
bool IsPCRel,
bool IsRelocWithSymbol,
- int64_t Addend) {
+ int64_t Addend) const {
// determine the type of the relocation
MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
@@ -1822,9 +1818,6 @@
}
}
- if (RelocNeedsGOT(Modifier))
- NeedsGOT = true;
-
return Type;
}
@@ -1862,7 +1855,7 @@
const MCFixup &Fixup,
bool IsPCRel,
bool IsRelocWithSymbol,
- int64_t Addend) {
+ int64_t Addend) const {
// determine the type of the relocation
unsigned Type = (unsigned)ELF::R_MIPS_NONE;
unsigned Kind = (unsigned)Fixup.getKind();
Modified: llvm/trunk/lib/MC/ELFObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.h?rev=147053&r1=147052&r2=147053&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.h (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.h Wed Dec 21 08:26:29 2011
@@ -351,7 +351,7 @@
protected:
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
- int64_t Addend) = 0;
+ int64_t Addend) const = 0;
virtual void adjustFixupOffset(const MCFixup &Fixup,
uint64_t &RelocOffset) {}
};
@@ -368,7 +368,7 @@
protected:
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
- int64_t Addend);
+ int64_t Addend) const;
};
@@ -395,11 +395,10 @@
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
- int64_t Addend);
+ int64_t Addend) const;
private:
unsigned GetRelocTypeInner(const MCValue &Target,
const MCFixup &Fixup, bool IsPCRel) const;
-
};
//===- PPCELFObjectWriter -------------------------------------------===//
@@ -414,7 +413,7 @@
protected:
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
- int64_t Addend);
+ int64_t Addend) const;
virtual void adjustFixupOffset(const MCFixup &Fixup, uint64_t &RelocOffset);
};
@@ -430,7 +429,7 @@
protected:
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
- int64_t Addend);
+ int64_t Addend) const;
};
//===- MipsELFObjectWriter -------------------------------------------===//
@@ -453,7 +452,7 @@
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
- int64_t Addend);
+ int64_t Addend) const;
};
}
More information about the llvm-commits
mailing list