From 4a828eeed33a6f11698b625190bc7eafceee3100 Mon Sep 17 00:00:00 2001 From: Lauro Ramos Venancio Date: Wed, 27 Jun 2007 22:08:09 +0000 Subject: llvm-nm must print the alias symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37766 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-nm/llvm-nm.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'tools/llvm-nm') diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index e001399..a1890a9 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -68,14 +68,19 @@ namespace { } static char TypeCharForSymbol(GlobalValue &GV) { - if (GV.isDeclaration()) return 'U'; + if (GV.isDeclaration()) return 'U'; if (GV.hasLinkOnceLinkage()) return 'C'; if (GV.hasWeakLinkage()) return 'W'; - if (isa(GV) && GV.hasInternalLinkage()) return 't'; + if (isa(GV) && GV.hasInternalLinkage()) return 't'; if (isa(GV)) return 'T'; - if (isa(GV) && GV.hasInternalLinkage()) return 'd'; + if (isa(GV) && GV.hasInternalLinkage()) return 'd'; if (isa(GV)) return 'D'; - return '?'; + if (const GlobalAlias *GA = dyn_cast(&GV)) { + const GlobalValue *AliasedGV = GA->getAliasedGlobal(); + if (isa(AliasedGV)) return 'T'; + if (isa(AliasedGV)) return 'D'; + } + return '?'; } static void DumpSymbolNameForGlobalValue(GlobalValue &GV) { @@ -115,7 +120,10 @@ static void DumpSymbolNamesFromModule(Module *M) { << " Size Line Section\n"; } std::for_each (M->begin (), M->end (), DumpSymbolNameForGlobalValue); - std::for_each (M->global_begin (), M->global_end (), DumpSymbolNameForGlobalValue); + std::for_each (M->global_begin (), M->global_end (), + DumpSymbolNameForGlobalValue); + std::for_each (M->alias_begin (), M->alias_end (), + DumpSymbolNameForGlobalValue); } static void DumpSymbolNamesFromFile(std::string &Filename) { -- cgit v1.1