diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -355,8 +355,9 @@ // any subsection splitting has occurred). It will be updated to represent the // same location as an offset relative to the start of the containing // subsection. +template static InputSection *findContainingSubsection(Subsections &subsections, - uint64_t *offset) { + T *offset) { auto it = std::prev(llvm::upper_bound( subsections, *offset, [](uint64_t value, Subsection subsec) { return value < subsec.offset; })); diff --git a/lld/MachO/Relocations.h b/lld/MachO/Relocations.h --- a/lld/MachO/Relocations.h +++ b/lld/MachO/Relocations.h @@ -56,13 +56,16 @@ uint8_t length = 0; // The offset from the start of the subsection that this relocation belongs // to. - uint64_t offset = 0; + uint32_t offset = 0; // Adding this offset to the address of the referent symbol or subsection // gives the destination that this relocation refers to. int64_t addend = 0; llvm::PointerUnion referent = nullptr; }; +static_assert(sizeof(void *) != 8 || sizeof(Reloc) == 24, + "Try to minimize Reloc's size; we create many instances"); + bool validateSymbolRelocation(const Symbol *, const InputSection *, const Reloc &);