[PATCH] D124143: [lld-macho] Allow dead_strip to work with exported private extern symbols

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 14:20:55 PDT 2022


int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: lld/MachO/MarkLive.cpp:231
           config->exportedSymbols.match(defined->getName())) {
-        // FIXME: Instead of doing this here, maybe the Driver code doing
-        // the matching should add them to explicitUndefineds? Then the
-        // explicitUndefineds code below would handle this automatically.
-        assert(!defined->privateExtern &&
-               "should have been rejected by driver");
+        // ld64 preserves all exported private extern symbols as live,
+        // irrespective of whether it is autohide.
----------------
maybe something like "NOTE: we are purposely not checking for `privateExtern` here because ..."

could also mention that exporting private externs is technically an ill-defined operation, so we are just following ld64's behavior


================
Comment at: lld/MachO/MarkLive.cpp:232
+        // ld64 preserves all exported private extern symbols as live,
+        // irrespective of whether it is autohide.
         marker->addSym(defined);
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124143



More information about the llvm-commits mailing list