Relax this condition.
[oota-llvm.git] / lib / MC / ELFObjectWriter.cpp
index 18fed21afc66266bdb15e4055a873a397f8202f4..99a675d392f9ebbda97560f6065ce2a0c3b47b62 100644 (file)
@@ -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,