forked from OSchip/llvm-project
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. llvm-svn: 136905
This commit is contained in:
parent
fddf530c5d
commit
dfbecd1eb7
|
@ -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,
|
||||
|
|
|
@ -347,6 +347,7 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
bool IsPCRel, bool IsRelocWithSymbol,
|
||||
int64_t Addend) = 0;
|
||||
virtual void adjustFixupOffset(const MCFixup &Fixup, uint64_t &RelocOffset) { }
|
||||
};
|
||||
|
||||
//===- X86ELFObjectWriter -------------------------------------------===//
|
||||
|
@ -408,6 +409,7 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
bool IsPCRel, bool IsRelocWithSymbol,
|
||||
int64_t Addend);
|
||||
virtual void adjustFixupOffset(const MCFixup &Fixup, uint64_t &RelocOffset);
|
||||
};
|
||||
|
||||
//===- MBlazeELFObjectWriter -------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue