[PATCH] D56063: [llvm-nm] Allow --size-sort to print symbols with only Symbol size
Saurabh Badhwar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 24 03:57:54 PST 2018
h4xr created this revision.
Herald added a subscriber: llvm-commits.
When llvm-nm is passed only the --size-sort option for an object file, there is no output generated.
The commit modifies the behavior to print the symbols sorted and their size which is also inline with
the output of the GNU nm tool.
Signed-off-by: Saurabh Badhwar <sbsaurabhbadhwar9 at gmail.com>
Repository:
rL LLVM
https://reviews.llvm.org/D56063
Files:
tools/llvm-nm/llvm-nm.cpp
Index: tools/llvm-nm/llvm-nm.cpp
===================================================================
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -796,8 +796,7 @@
bool Global = SymFlags & SymbolRef::SF_Global;
bool Weak = SymFlags & SymbolRef::SF_Weak;
if ((!Undefined && UndefinedOnly) || (Undefined && DefinedOnly) ||
- (!Global && ExternalOnly) || (SizeSort && !PrintAddress) ||
- (Weak && NoWeakSymbols))
+ (!Global && ExternalOnly) || (Weak && NoWeakSymbols))
continue;
if (PrintFileName)
writeFileName(outs());
@@ -830,7 +829,7 @@
strcpy(SymbolAddrStr, printDashes);
else if(MachO && I->TypeChar == 'I')
strcpy(SymbolAddrStr, printBlanks);
- else
+ else if(PrintAddress)
format(printFormat, I->Address)
.print(SymbolAddrStr, sizeof(SymbolAddrStr));
format(printFormat, I->Size).print(SymbolSizeStr, sizeof(SymbolSizeStr));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56063.179464.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181224/39f9c1a3/attachment.bin>
More information about the llvm-commits
mailing list