+const MachOObjectFileBase::RelocationEntry *
+MachOObjectFileBase::getRelocation(DataRefImpl Rel) const {
+ if (const MachOObjectFile32Le *O = dyn_cast<MachOObjectFile32Le>(this))
+ return O->getRelocation(Rel);
+ const MachOObjectFile64Le *O = dyn_cast<MachOObjectFile64Le>(this);
+ return O->getRelocation(Rel);
+}
+
+bool MachOObjectFileBase::isScattered(const RelocationEntry *RE) const {
+ unsigned Arch = getArch();
+ return (Arch != Triple::x86_64) && (RE->Address & macho::RF_Scattered);
+}
+
+bool MachOObjectFileBase::isPCRel(const RelocationEntry *RE) const {
+ if (isScattered(RE)) {
+ const ScatteredRelocationEntry *SRE =
+ reinterpret_cast<const ScatteredRelocationEntry *>(RE);
+ return SRE->getPCRel();
+ }
+ return RE->getPCRel();
+}
+
+unsigned MachOObjectFileBase::getLength(const RelocationEntry *RE) const {
+ if (isScattered(RE)) {
+ const ScatteredRelocationEntry *SRE =
+ reinterpret_cast<const ScatteredRelocationEntry *>(RE);
+ return SRE->getLength();
+ }
+ return RE->getLength();
+}
+
+unsigned MachOObjectFileBase::getType(const RelocationEntry *RE) const {
+ if (isScattered(RE)) {
+ const ScatteredRelocationEntry *SRE =
+ reinterpret_cast<const ScatteredRelocationEntry *>(RE);
+ return SRE->getType();
+ }
+ return RE->getType();
+}
+