diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-21 14:26:29 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-21 14:26:29 +0000 |
commit | 9e252bf0387922e0c7f1873b644902da7eecbec6 (patch) | |
tree | 31ec653c154cfcc7e1b9407661f6f6a4e04ca5d2 /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | b761ff3e24fc70885419d1c29b3bf4a8dd2f976e (diff) | |
download | bcm5719-llvm-9e252bf0387922e0c7f1873b644902da7eecbec6.tar.gz bcm5719-llvm-9e252bf0387922e0c7f1873b644902da7eecbec6.zip |
Small refactoring so that RelocNeedsGOT can stay in the target independent
side when the target specific bits are moved to the Target directory.
llvm-svn: 147053
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 92aad94f17f..fa5321d3a74 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -447,6 +447,10 @@ void ELFObjectWriter::RecordRelocation(const MCAssembler &Asm, 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 @@ unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target, 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 @@ unsigned PPCELFObjectWriter::GetRelocType(const MCValue &Target, 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 @@ unsigned MBlazeELFObjectWriter::GetRelocType(const MCValue &Target, 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 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target, 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 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target, } } - if (RelocNeedsGOT(Modifier)) - NeedsGOT = true; - return Type; } @@ -1862,7 +1855,7 @@ unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target, 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(); |