}
static void
-makeScatteredRelocationInfo(MachO::scattered_relocation_info &MRE,
+makeScatteredRelocationInfo(MachO::any_relocation_info &MRE,
const uint32_t Addr, const unsigned Type,
const unsigned Log2Size, const unsigned IsPCRel,
const uint32_t Value2) {
- MRE.r_scattered = true;
- MRE.r_pcrel = IsPCRel;
- MRE.r_length = Log2Size;
- MRE.r_type = Type;
- MRE.r_address = Addr;
- MRE.r_value = Value2;
+ // For notes on bitfield positions and endianness, see:
+ // https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/20001298-scattered_relocation_entry
+ MRE.r_word0 = ((Addr << 0) | (Type << 24) | (Log2Size << 28) |
+ (IsPCRel << 30) | MachO::R_SCATTERED);
+ MRE.r_word1 = Value2;
}
/// Compute fixup offset (address).
break;
}
- MachO::scattered_relocation_info MRE;
+ MachO::any_relocation_info MRE;
makeScatteredRelocationInfo(MRE, other_half, MachO::GENERIC_RELOC_PAIR,
Log2Size, IsPCRel, Value2);
Writer->addRelocation(Fragment->getParent(), MRE);
if (FixupOffset > 0xffffff)
return false;
}
- MachO::scattered_relocation_info MRE;
+ MachO::any_relocation_info MRE;
makeScatteredRelocationInfo(MRE, FixupOffset, Type, Log2Size, IsPCRel, Value);
Writer->addRelocation(Fragment->getParent(), MRE);
return true;
FixedValue -= Writer->getSectionAddress(Fragment->getParent());
}
+ // struct relocation_info (8 bytes)
MachO::any_relocation_info MRE;
makeRelocationInfo(MRE, FixupOffset, Index, IsPCRel, Log2Size, IsExtern,
Type);