[PATCH] D106128: [lld-macho] Use immediate encodings for bind opcodes

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 22:45:58 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/SyntheticSections.cpp:368
+    if ((p->opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB)
+          && (p->data < (15*sizeof(uint64_t)))
+          && ((p->data % sizeof(uint64_t)) == 0)) {
----------------
thevinster wrote:
> int3 wrote:
> > thevinster wrote:
> > > I believe `ld64` switches off the type based on whether it operates on a 32-bit or a 64-bit. I didn't get a chance to verify it because LLD doesn't seem to support `i386` (https://github.com/llvm/llvm-project/blob/main/lld/MachO/Driver.cpp#L700-L711). 
> > can we have a comment explaining how `BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED` works, and where the 15 and `sizeof(uint64_t)` is coming from?
> That was quick! Will add a comment about the `15`. As far as the `sizeof(uint64_t)`, I wrote a comment above describing that situation. 
I'm confused as to why LLD not supporting i386 matters for testing ld64's behavior. llvm-mc can emit i386 object files that we can pass to ld64...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106128/new/

https://reviews.llvm.org/D106128



More information about the llvm-commits mailing list