aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-nm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-13 05:44:34 +0000
committerChris Lattner <sabre@nondot.org>2009-04-13 05:44:34 +0000
commit266c7bbbbcc4b326dea82e577de1a415d6acc23e (patch)
treee880304f13d90f5926ead058f546b05e325dd5a2 /tools/llvm-nm
parent2c71b8f64f571b34e8df2a83120a2e889627b8d4 (diff)
downloadexternal_llvm-266c7bbbbcc4b326dea82e577de1a415d6acc23e.zip
external_llvm-266c7bbbbcc4b326dea82e577de1a415d6acc23e.tar.gz
external_llvm-266c7bbbbcc4b326dea82e577de1a415d6acc23e.tar.bz2
Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc. Related bugzilla's include PR3517, PR3100, & PR2933. Nothing uses this yet, but it appears to work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-nm')
-rw-r--r--tools/llvm-nm/llvm-nm.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index 3449510..324e0f6 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -69,7 +69,6 @@ namespace {
}
static char TypeCharForSymbol(GlobalValue &GV) {
- /* FIXME: what to do with private linkage? */
if (GV.isDeclaration()) return 'U';
if (GV.hasLinkOnceLinkage()) return 'C';
if (GV.hasCommonLinkage()) return 'C';
@@ -87,8 +86,11 @@ static char TypeCharForSymbol(GlobalValue &GV) {
}
static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
+ // Private linkage and available_externally linkage don't exist in symtab.
+ if (GV.hasPrivateLinkage() || GV.hasAvailableExternallyLinkage()) return;
+
const std::string SymbolAddrStr = " "; // Not used yet...
- char TypeChar = TypeCharForSymbol (GV);
+ char TypeChar = TypeCharForSymbol(GV);
if ((TypeChar != 'U') && UndefinedOnly)
return;
if ((TypeChar == 'U') && DefinedOnly)
@@ -96,17 +98,17 @@ static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
if (GV.hasLocalLinkage () && ExternalOnly)
return;
if (OutputFormat == posix) {
- std::cout << GV.getName () << " " << TypeCharForSymbol (GV) << " "
+ std::cout << GV.getName () << " " << TypeCharForSymbol(GV) << " "
<< SymbolAddrStr << "\n";
} else if (OutputFormat == bsd) {
- std::cout << SymbolAddrStr << " " << TypeCharForSymbol (GV) << " "
+ std::cout << SymbolAddrStr << " " << TypeCharForSymbol(GV) << " "
<< GV.getName () << "\n";
} else if (OutputFormat == sysv) {
std::string PaddedName (GV.getName ());
while (PaddedName.length () < 20)
PaddedName += " ";
std::cout << PaddedName << "|" << SymbolAddrStr << "| "
- << TypeCharForSymbol (GV)
+ << TypeCharForSymbol(GV)
<< " | | | |\n";
}
}
@@ -122,10 +124,10 @@ static void DumpSymbolNamesFromModule(Module *M) {
<< "Name Value Class Type"
<< " Size Line Section\n";
}
- std::for_each (M->begin (), M->end (), DumpSymbolNameForGlobalValue);
- std::for_each (M->global_begin (), M->global_end (),
+ std::for_each (M->begin(), M->end(), DumpSymbolNameForGlobalValue);
+ std::for_each (M->global_begin(), M->global_end(),
DumpSymbolNameForGlobalValue);
- std::for_each (M->alias_begin (), M->alias_end (),
+ std::for_each (M->alias_begin(), M->alias_end(),
DumpSymbolNameForGlobalValue);
}