summaryrefslogtreecommitdiff
path: root/tools/llvm-nm
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-07-06 19:21:04 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-07-06 19:21:04 +0000
commit40b3496f9ae621250f90b1a107f3ad54b4e8e137 (patch)
treeb6dd01652104f172ef55b55ff427b83c9211fdc5 /tools/llvm-nm
parentbe2ff7bc98825658def8c190efeca49303334537 (diff)
When sorting by address, undefined symbols go first.
This matches gnu nm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-nm')
-rw-r--r--tools/llvm-nm/llvm-nm.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index 961754ccefa..c30d628d9a5 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -185,6 +185,10 @@ struct NMSymbol {
}
static bool compareSymbolAddress(const NMSymbol &A, const NMSymbol &B) {
+ if (A.TypeChar == 'U' && B.TypeChar != 'U')
+ return true;
+ if (A.TypeChar != 'U' && B.TypeChar == 'U')
+ return false;
if (A.Address < B.Address)
return true;
if (A.Address == B.Address && A.Name < B.Name)