summaryrefslogtreecommitdiffstats
path: root/tools/llvm-nm
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2012-11-13 18:38:42 +0000
committerShankar Easwaran <shankare@codeaurora.org>2012-11-13 18:38:42 +0000
commit206252cc9f5509b27aa0761c677fdee8daff001c (patch)
tree10ffe1df6508703df2117670df2f4f0e38076d98 /tools/llvm-nm
parentf7414823871c7707a6af61c19e5f9ce3a4fa861c (diff)
downloadexternal_llvm-206252cc9f5509b27aa0761c677fdee8daff001c.zip
external_llvm-206252cc9f5509b27aa0761c677fdee8daff001c.tar.gz
external_llvm-206252cc9f5509b27aa0761c677fdee8daff001c.tar.bz2
Adding changes to support GNU style archive library reading
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-nm')
-rw-r--r--tools/llvm-nm/llvm-nm.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index 0543e83..153de95 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -113,6 +113,10 @@ namespace {
cl::opt<bool> WithoutAliases("without-aliases", cl::Hidden,
cl::desc("Exclude aliases from output"));
+ cl::opt<bool> ArchiveMap("print-armap",
+ cl::desc("Print the archive map"));
+ cl::alias ArchiveMaps("s", cl::desc("Alias for --print-armap"),
+ cl::aliasopt(ArchiveMap));
bool PrintAddress = true;
bool MultipleFiles = false;
@@ -346,6 +350,24 @@ static void DumpSymbolNamesFromFile(std::string &Filename) {
return;
if (object::Archive *a = dyn_cast<object::Archive>(arch.get())) {
+ if (ArchiveMap) {
+ outs() << "Archive map" << "\n";
+ for (object::Archive::symbol_iterator i = a->begin_symbols(),
+ e = a->end_symbols(); i != e; ++i) {
+ object::Archive::child_iterator c;
+ StringRef symname;
+ StringRef filename;
+ if (error(i->getMember(c)))
+ return;
+ if (error(i->getName(symname)))
+ return;
+ if (error(c->getName(filename)))
+ return;
+ outs() << symname << " in " << filename << "\n";
+ }
+ outs() << "\n";
+ }
+
for (object::Archive::child_iterator i = a->begin_children(),
e = a->end_children(); i != e; ++i) {
OwningPtr<Binary> child;