[PATCH] D114737: [lld][Macho] Include dead-stripped symbols in mapfile
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 26 14:17:16 PST 2022
int3 added inline comments.
================
Comment at: lld/MachO/MapFile.cpp:44
+using Symbols = std::vector<Defined *>;
+// Returns only live symbols if `Live` is true. Else, returns only dead-stripped
+// symbols.
----------------
outdated comment
================
Comment at: lld/MachO/MapFile.cpp:140-152
+ if (live) {
+ for (Symbol *sym : syms) {
+ assert(sym->isLive());
+ os << format("0x%08llX\t[%3u] %s\n", sym->getVA(),
+ readerToFileOrdinal[sym->getFile()], symStr[sym].c_str());
+ }
+ } else {
----------------
with the `if` being hoisted out, I'm not sure this `writeSymbols` function is really factoring out a useful amount of code. How about inlining it?
================
Comment at: lld/MachO/MapFile.cpp:160
- // TODO: when we implement -dead_strip, we should dump dead stripped symbols
+ if (config->deadStrip) {
+ os << "# Dead Stripped Symbols:\n";
----------------
I was wondering if this should be `!deadSymbols.empty()`, but it seems like `config->deadStrip` is the right one as ld64 will emit the "Dead Stripped Symbols" line as long as `-dead_strip` is passed. Can we have a test that checks for the case where no symbols get stripped?
================
Comment at: lld/test/MachO/dead-strip.s:10
## and aren't in the export trie.
## Dead-stripped symbols should also not be in a map file output.
# RUN: %lld -lSystem -dead_strip -map %t/map -u _ref_private_extern_u \
----------------
outdated comment
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