diff options
author | Roman Divacky <rdivacky@freebsd.org> | 2011-08-04 19:08:19 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@freebsd.org> | 2011-08-04 19:08:19 +0000 |
commit | 2a66cea1b82b82c7bf19e232aed741331377ad30 (patch) | |
tree | 885148ba415132590c98487130e5d86865c623c4 /lib/MC/ELFObjectWriter.cpp | |
parent | ad90d3a343ca73c32693e2b05b74462ccd9659cd (diff) |
Introduce adjustFixupOffset that adjusts the fixup offset of a relocation.
This is meant to be overriden by backends. Implement an override on PowerPC
which adjusts the offset by 2 for ha16/lo16 relocation kinds. This removes
a commented out hack and enables hello world to be compiled on PowerPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 18fed21afc..99a675d392 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -447,18 +447,8 @@ void ELFObjectWriter::RecordRelocation(const MCAssembler &Asm, uint64_t RelocOffset = Layout.getFragmentOffset(Fragment) + Fixup.getOffset(); -#if 0 - // TODO: This is necessary on PPC32 but it must be implemented - // in a different way. - switch ((unsigned)Fixup.getKind()) { - case PPC::fixup_ppc_ha16: - case PPC::fixup_ppc_lo16: - RelocOffset += 2; - break; - default: - break; - } -#endif + + adjustFixupOffset(Fixup, RelocOffset); if (!hasRelocationAddend()) Addend = 0; @@ -1583,6 +1573,18 @@ unsigned PPCELFObjectWriter::GetRelocType(const MCValue &Target, return Type; } +void +PPCELFObjectWriter::adjustFixupOffset(const MCFixup &Fixup, uint64_t &RelocOffset) { + switch ((unsigned)Fixup.getKind()) { + case PPC::fixup_ppc_ha16: + case PPC::fixup_ppc_lo16: + RelocOffset += 2; + break; + default: + break; + } +} + //===- MBlazeELFObjectWriter -------------------------------------------===// MBlazeELFObjectWriter::MBlazeELFObjectWriter(MCELFObjectTargetWriter *MOTW, |