[PATCH] D113818: [MachO] Shrink reloc from 32 bytes to 24 bytes
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 17:03:59 PST 2021
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.
Thanks!
================
Comment at: lld/MachO/InputFiles.cpp:355
+template <class T>
+static InputSection *findContainingSubsection(SubsectionMap &map, T *offset) {
auto it = std::prev(llvm::upper_bound(
----------------
smeenai wrote:
> int3 wrote:
> > hm, can't we leave it as uint64_t and have the uint32_t be automatically promoted?
> Promotion doesn't happen for pointer arguments (you wouldn't wanna write 8 bytes into a 4 byte storage slot).
OH right. I knew that, I just couldn't read :P
> If reviewers prefer, I could instead make findContainingSubsection take the InputSection * as the output argument and return the adjusted offset, so that the return value can just be downcast instead of needing a template.
Nah this seems ugly in a different way, `findFoo` functions should generally return `Foo`s...
Maybe add a comment here that we expect `T` to be either uint32_t or uint64_t?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113818/new/
https://reviews.llvm.org/D113818
More information about the llvm-commits
mailing list