[PATCH] D114737: [lld][Macho] Include dead-stripped symbols in mapfile

Roger Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 12:12:51 PST 2022


Roger added a comment.

In D114737#3216825 <https://reviews.llvm.org/D114737#3216825>, @thevinster wrote:

> The output from ld64 doesn't look like what lld produces.

You're right that the new dead symbol section is not exactly the same as what ld64 outputs.  look `lld/test/MachO/dead-strip.s`. I followed the precedence set by lld's section for live symbols and basically replicated that for dead symbols. Do you think this needs to be changed?

> Also the command you linked above doesn't pass in `dead_strip`. Is ld64 always outputting dead stripped symbols regardless of the flag or is the summary a typo?

Yeah, it was a typo. I fixed the summary.



================
Comment at: lld/MachO/MapFile.cpp:57
+  parallelSort(v.begin(), v.end(), [Live](Defined *a, Defined *b) {
+    return Live && a->getVA() != b->getVA() ? a->getVA() < b->getVA()
+                                            : a->getName() < b->getName();
----------------
thevinster wrote:
> Why do we need to propagate `Live` to the lambda? Does ld64 order dead stripped symbols by the name only?
The ordering for live symbols is first by virtual address and then by name. As I understand, dead-stripped symbols don't have virtual addresses so we can just order by name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114737



More information about the llvm-commits mailing list