[PATCH] D139069: [lld-macho] Ignored aliases to weak symbols should not retain section data

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 19:26:59 PST 2022


oontvoo added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:624
 
+static bool isIgnoredName(StringRef name) {
+  return name.startswith("l") || name.startswith("L");
----------------
super nit ...


================
Comment at: lld/MachO/InputFiles.cpp:840-849
+      if (nList[lhs].n_value == nList[rhs].n_value)
+        return !isIgnoredName(getSymName(nList[lhs])) &&
+               isIgnoredName(getSymName(nList[rhs]));
       return nList[lhs].n_value < nList[rhs].n_value;
     });
     for (size_t j = 0; j < symbolIndices.size(); ++j) {
       const uint32_t symIndex = symbolIndices[j];
----------------
This seems like we'd be repeating the `strtab + sym.n_strx` a lot ... i wonder if it's worth pre-computing the names once and just use the stored values?


================
Comment at: lld/test/MachO/weak-def-alias-ignored.s:16
+## ensure the linker correctly shuffles them around when their aliasees get
+## coalesced.Emulating the behavior of weak binds for non-ignored symbols would
+## be even trickier. Let's just deal with ignored symbols for now until we find
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139069



More information about the llvm-commits mailing list