[PATCH] D93318: [lld/mac] Set ordinal on dynamic undefined symbols in symbol table

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 11:19:26 PST 2020


thakis added a comment.

Thanks!



================
Comment at: lld/MachO/SyntheticSections.cpp:757-759
+      uint16_t n_desc = nList->n_desc;
+      MachO::SET_LIBRARY_ORDINAL(n_desc, dysym->file->ordinal);
+      nList->n_desc = n_desc;
----------------
int3 wrote:
> why not just pass `nList->n_desc` into `SET_LIBRARY_ORDINAL`? I suppose this is a bit more explicit about the fact that we're modifying `n_desc`, but I think it's already pretty obvious from the `SET_` in the name...
Because `SET_LIBRARY_ORDINAL` wants a `uint16_t&` but `nList->n_desc` is a `llvm::support::ulittle16_t`. I suppose we could templatize `SET_LIBRARY_ORDINAL` instead, but I could see us wanting to reaad `n_desk` once at the top of the loop, then modify it in the body, and then write it once at the end anyways, so that's a step in that direction.


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

https://reviews.llvm.org/D93318



More information about the llvm-commits mailing list