summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm/llvm-nm.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2018-03-29 20:04:29 +0000
committerKevin Enderby <enderby@apple.com>2018-03-29 20:04:29 +0000
commitd9911f6f7baca75a9d51352bf9ef3718ee05cd82 (patch)
treec47555f3648246d792375778d0d18efb22d70236 /llvm/tools/llvm-nm/llvm-nm.cpp
parent943e12e1c54c06458a31ae88974ed7b0d0babb14 (diff)
downloadbcm5719-llvm-d9911f6f7baca75a9d51352bf9ef3718ee05cd82.tar.gz
bcm5719-llvm-d9911f6f7baca75a9d51352bf9ef3718ee05cd82.zip
For llvm-nm and Mach-O files that are fully stripped, special case a redacted LC_MAIN
As a further refinement on: r328274 - For llvm-nm and Mach-O files also use function starts info in some cases when printing symbols we want to special case a redacted LC_MAIN so it is easier to find. rdar://38978929 llvm-svn: 328820
Diffstat (limited to 'llvm/tools/llvm-nm/llvm-nm.cpp')
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index e494920018d..4282a605c45 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -1588,8 +1588,10 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
}
}
- // Trying adding symbol from the function starts table.
+ // Trying adding symbol from the function starts table and LC_MAIN entry
+ // point.
SmallVector<uint64_t, 8> FoundFns;
+ int64_t lc_main_offset = -1;
for (const auto &Command : MachO->load_commands()) {
if (Command.C.cmd == MachO::LC_FUNCTION_STARTS) {
// We found a function starts segment, parse the addresses for
@@ -1598,6 +1600,10 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
MachO->getLinkeditDataLoadCommand(Command);
MachO->ReadULEB128s(LLC.dataoff, FoundFns);
+ } else if (Command.C.cmd == MachO::LC_MAIN) {
+ MachO::entry_point_command LCmain =
+ MachO->getEntryPointCommand(Command);
+ lc_main_offset = LCmain.entryoff;
}
}
// See if these addresses are already in the symbol table.
@@ -1647,7 +1653,10 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
F.NDesc = 0;
F.IndirectName = StringRef();
SymbolList.push_back(F);
- FOS << "<redacted function " << f << ">";
+ if (FoundFns[f] == (uint64_t)lc_main_offset)
+ FOS << "<redacted LC_MAIN>";
+ else
+ FOS << "<redacted function " << f << ">";
FOS << '\0';
FunctionStartsAdded++;
}
OpenPOWER on IntegriCloud