[PATCH] D89257: [lld-macho] Emit STABS symbols for debugging, and drop debug sections

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 18:41:09 PST 2020


smeenai added a comment.

> We could just add a size field to our Symbol class. This seems simpler, and I'm more inclined toward it, but I'm not sure if there are use cases that it doesn't handle well. As such I'm punting on the decision for now.

Yeah, I like this more too, but punting on it until later is fine.

As far as I can see, we only need a very small amount of information from the DWARF in the object file (the source file information). Do you know if the DWARF parsing is done lazily (so we only pay the cost for the parts of the DWARF we care about), or if it'll attempt to parse the entirety of the object file's DWARF (which would be wasteful)?



================
Comment at: lld/MachO/SyntheticSections.cpp:618
+    stab.sect = 1;
+    stab.strx = stringTableSection.addString(defined->getName());
+    stab.value = defined->getVA();
----------------
I guess we can optimize this later to not duplicate strings in the string table? (Since the symbol table entry will also add the symbol name.)


================
Comment at: lld/MachO/SyntheticSections.cpp:649-650
+      InputSection *isec = defined->isec;
+      // XXX is it right to assume that all symbols in __text are function
+      // symbols?
+      if (isec->name == "__text") {
----------------
I think this is valid. How does ld64 make this determination though?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89257



More information about the llvm-commits mailing list