[PATCH] D113818: [MachO] Shrink reloc from 32 bytes to 24 bytes
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 16 16:31:12 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG93bf271f2743: [MachO] Shrink reloc from 32 bytes to 24 bytes (authored by smeenai).
Changed prior to commit:
https://reviews.llvm.org/D113818?vs=386982&id=387785#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113818/new/
https://reviews.llvm.org/D113818
Files:
lld/MachO/InputFiles.cpp
lld/MachO/Relocations.h
Index: lld/MachO/Relocations.h
===================================================================
--- lld/MachO/Relocations.h
+++ 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<Symbol *, InputSection *> 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 &);
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ 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 <class T>
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; }));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113818.387785.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211117/ccb5c6ee/attachment.bin>
More information about the llvm-commits
mailing list