[llvm] r241488 - When sorting by address, undefined symbols go first.
Rafael Espindola
rafael.espindola at gmail.com
Mon Jul 6 12:21:04 PDT 2015
Author: rafael
Date: Mon Jul 6 14:21:04 2015
New Revision: 241488
URL: http://llvm.org/viewvc/llvm-project?rev=241488&view=rev
Log:
When sorting by address, undefined symbols go first.
This matches gnu nm.
Modified:
llvm/trunk/test/Object/coff-archive.test
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
Modified: llvm/trunk/test/Object/coff-archive.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/coff-archive.test?rev=241488&r1=241487&r2=241488&view=diff
==============================================================================
--- llvm/trunk/test/Object/coff-archive.test (original)
+++ llvm/trunk/test/Object/coff-archive.test Mon Jul 6 14:21:04 2015
@@ -66,7 +66,24 @@ CHECKIDX: 00000000 N .debug$T
CHECKIDX: 00000000 i .drectve
CHECKIDX: 00000001 a @feat.00
CHECKIDX: 00ab9d1b a @comp.id
+
CHECKIDX: Debug\mymath.obj:
+CHECKIDX: U ??2 at YAPAXI@Z
+CHECKIDX: U ??3 at YAXPAX@Z
+CHECKIDX: U ??_7type_info@@6B@
+CHECKIDX: U ??_Ginvalid_argument at std@@UAEPAXI at Z
+CHECKIDX: U ??_Glogic_error at std@@UAEPAXI at Z
+CHECKIDX: U ?what at exception@std@@UBEPBDXZ
+CHECKIDX: U @__security_check_cookie at 4
+CHECKIDX: U __CxxThrowException at 8
+CHECKIDX: U __RTC_CheckEsp
+CHECKIDX: U __RTC_InitBase
+CHECKIDX: U __RTC_Shutdown
+CHECKIDX: U ___CxxFrameHandler3
+CHECKIDX: U ___security_cookie
+CHECKIDX: U __fltused
+CHECKIDX: U __imp_??0exception at std@@QAE at ABQBD@Z
+CHECKIDX: U __imp_??1exception at std@@UAE at XZ
CHECKIDX: 00000000 d .data
CHECKIDX: 00000000 d .data
CHECKIDX: 00000000 d .data
@@ -205,21 +222,5 @@ CHECKIDX: 00000004 R ??_7logic_error at std
CHECKIDX: 00000008 r __ehfuncinfo$?Divide at MyMathFuncs@MathFuncs@@SANNN at Z
CHECKIDX: 0000000e t __ehhandler$?Divide at MyMathFuncs@MathFuncs@@SANNN at Z
CHECKIDX: 00ab9d1b a @comp.id
-CHECKIDX: U ??2 at YAPAXI@Z
-CHECKIDX: U ??3 at YAXPAX@Z
-CHECKIDX: U ??_7type_info@@6B@
CHECKIDX: w ??_Einvalid_argument at std@@UAEPAXI at Z
CHECKIDX: w ??_Elogic_error at std@@UAEPAXI at Z
-CHECKIDX: U ??_Ginvalid_argument at std@@UAEPAXI at Z
-CHECKIDX: U ??_Glogic_error at std@@UAEPAXI at Z
-CHECKIDX: U ?what at exception@std@@UBEPBDXZ
-CHECKIDX: U @__security_check_cookie at 4
-CHECKIDX: U __CxxThrowException at 8
-CHECKIDX: U __RTC_CheckEsp
-CHECKIDX: U __RTC_InitBase
-CHECKIDX: U __RTC_Shutdown
-CHECKIDX: U ___CxxFrameHandler3
-CHECKIDX: U ___security_cookie
-CHECKIDX: U __fltused
-CHECKIDX: U __imp_??0exception at std@@QAE at ABQBD@Z
-CHECKIDX: U __imp_??1exception at std@@UAE at XZ
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=241488&r1=241487&r2=241488&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Mon Jul 6 14:21:04 2015
@@ -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)
More information about the llvm-commits
mailing list