diff options
author | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2007-06-27 22:08:09 +0000 |
---|---|---|
committer | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2007-06-27 22:08:09 +0000 |
commit | 4a828eeed33a6f11698b625190bc7eafceee3100 (patch) | |
tree | f2098cb2fec92a110a2c2ccad3f48cb39d66704b /tools/llvm-nm | |
parent | 1ceda1d63ed128b34c332c81890f314ce2e5373d (diff) | |
download | external_llvm-4a828eeed33a6f11698b625190bc7eafceee3100.zip external_llvm-4a828eeed33a6f11698b625190bc7eafceee3100.tar.gz external_llvm-4a828eeed33a6f11698b625190bc7eafceee3100.tar.bz2 |
llvm-nm must print the alias symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-nm')
-rw-r--r-- | tools/llvm-nm/llvm-nm.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
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<Function>(GV) && GV.hasInternalLinkage()) return 't'; + if (isa<Function>(GV) && GV.hasInternalLinkage()) return 't'; if (isa<Function>(GV)) return 'T'; - if (isa<GlobalVariable>(GV) && GV.hasInternalLinkage()) return 'd'; + if (isa<GlobalVariable>(GV) && GV.hasInternalLinkage()) return 'd'; if (isa<GlobalVariable>(GV)) return 'D'; - return '?'; + if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(&GV)) { + const GlobalValue *AliasedGV = GA->getAliasedGlobal(); + if (isa<Function>(AliasedGV)) return 'T'; + if (isa<GlobalVariable>(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) { |