[PATCH] D102619: [lld/mac] Honor REFERENCED_DYAMICALLY, set it on __mh_execute_header

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 10:50:28 PDT 2021


thakis added a comment.

Thanks!



================
Comment at: lld/MachO/InputFiles.cpp:493-496
     return symtab->addDefined(name, isec->file, isec, value, size,
                               sym.n_desc & N_WEAK_DEF, isPrivateExtern,
-                              sym.n_desc & N_ARM_THUMB_DEF);
+                              sym.n_desc & N_ARM_THUMB_DEF,
+                              sym.n_desc & REFERENCED_DYNAMICALLY);
----------------
int3 wrote:
> Hmm I wonder if we should have Defined's ctor take in `n_desc` directly and then parses those flags. The list of params is getting a bit unwieldy
That either splits up the isWeakDefCanBeHidden code a bit awkwardly. Mind if I punt on that for now?


================
Comment at: lld/MachO/SyntheticSections.cpp:859-860
       nList->n_desc |= defined->isExternalWeakDef() ? N_WEAK_DEF : 0;
+      if (defined->referencedDynamically)
+        nList->n_desc |= REFERENCED_DYNAMICALLY;
     } else if (auto *dysym = dyn_cast<DylibSymbol>(entry.sym)) {
----------------
int3 wrote:
> nit: can we use a ternary like the other two lines above?
Sure, done. It's two lines either way, so I figured I could do the more obvious two lines. But local consistency is good too.


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

https://reviews.llvm.org/D102619



More information about the llvm-commits mailing list