[PATCH] D105075: [lld-macho] Only emit one BIND_OPCODE_SET_SYMBOL per symbol

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 13:01:50 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/SyntheticSections.cpp:357
+  std::vector<std::pair<const Sym *, std::vector<BindingEntry>>> bindingsVec(
+      bindingsMap.begin(), bindingsMap.end());
+  for (auto &p : bindingsVec) {
----------------
thakis wrote:
> Is it guaranteed that we have filtered out separate symbols pointing at the same address by now? If not, this has nondeterminism issues (here and in the sort below)
These are binding address, not symbol addresses, and I don't think any well-formed program will have two bindings pointing to the same address. I'm not even sure how you would generate that; I suppose you could use obj2yaml to hand-craft two relocations pointing at the same address, but I don't think it's possible if you're writing assembly.

Also FWIW I double-checked with `-DLLVM_ENABLE_EXPENSIVE_CHECKS`, and our test cases don't find any issues with this


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105075



More information about the llvm-commits mailing list