llvm-nm: Don't print value or size for undefined or weak symbols
authorMeador Inge <meadori@codesourcery.com>
Wed, 23 Nov 2016 20:17:15 +0000 (20:17 +0000)
committerMeador Inge <meadori@codesourcery.com>
Wed, 23 Nov 2016 20:17:15 +0000 (20:17 +0000)
commitf74d99950d3f3e2f67859d190e404b27adfd41f7
treef1a40bff84a6a0149739602c9534bbff5bc3a926
parent2eaacda53e0cab1c38bf077b2700ed6ef65e2b25
llvm-nm: Don't print value or size for undefined or weak symbols

Undefined and weak symbols don't have a meaningful size or value.
As such, nothing should be printed for those attributes (this is
already done for the address with 'U') with the BSD format.  This
matches what GNU nm does.

Note that for the POSIX.2 format [1] zero values are still
printed for the size and value.  This seems in spirit with
the format strings in that specification, but is debatable.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/

Differential Revision: https://reviews.llvm.org/D26936

llvm-svn: 287802
llvm/test/Object/nm-trivial-object.test
llvm/test/tools/llvm-nm/X86/Inputs/weak.obj.elf-x86_64 [new file with mode: 0644]
llvm/test/tools/llvm-nm/X86/weak.test [new file with mode: 0644]
llvm/tools/llvm-nm/llvm-nm.cpp