[PATCH] D85081: [lld-macho] Support dynamic linking of thread-locals

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 10:10:55 PDT 2020


int3 added inline comments.


================
Comment at: lld/MachO/SyntheticSections.cpp:141
   } else if (lastBinding.offset != offset) {
-    assert(lastBinding.offset <= offset);
     os << static_cast<uint8_t>(BIND_OPCODE_ADD_ADDR_ULEB);
----------------
compnerd wrote:
> Why the removal of this assert?  Seems unrelated (I suspect its related to the TLV section being filled in).
yeah there's no guarantee that the TLV section will come after the GOT / before the rest of the sections. Actually there's no guarantee that the GOT comes before either, I think we just got lucky that the assert didn't get triggered earlier...

Anyway, I previously added this assert because I'd thought that `BIND_OPCODE_ADD_ADDR_ULEB` was adding an unsigned, arbitrary-sized integer to the address offset. But it turns out that it's actually adding a signed 64-bit value, so we can subtract from the offset here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85081



More information about the llvm-commits mailing list