[LLVMbugs] [Bug 13613] New: llvm-nm prints incorrect symbol types on Mac
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Aug 15 07:22:18 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13613
Bug #: 13613
Summary: llvm-nm prints incorrect symbol types on Mac
Product: tools
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-nm
AssignedTo: unassignedbugs at nondot.org
ReportedBy: samsonov at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
llvm-nm seems to be broken for mach-o binaries:
$ cat main.cc
extern "C" {
__attribute__((visibility("default")))
void f1() {}
__attribute__((visibility("default")))
__attribute__((weak))
void f2() {}
} // extern "C"
int main() {
return 0;
}
$ clang++ main.cc
$ nm a.out
0000000100001040 S _NXArgc
0000000100001048 S _NXArgv
0000000100001058 S ___progname
0000000100000000 T __mh_execute_header
0000000100001050 S _environ
U _exit
0000000100000ec0 T _f1
0000000100000ef0 T _f2
0000000100000ed0 T _main
0000000100001000 s _pvars
U dyld_stub_binder
0000000100000e80 T start
$ llvm-nm a.out
100001040 s _NXArgc
100001048 s _NXArgv
100001058 s ___progname
100000000 S __mh_execute_header
100001050 s _environ
00000000 u _exit
100000ec0 s _f1
100000ed0 s _main
100001000 s _pvars
00000000 u dyld_stub_binder
100000e80 s start
1. Notice that symbol _f2 is just gone - I've checked that it somewhy has
SF_FormatSpecific flag and is excluded in the following statement in
llvm-nm.cpp:
297 if (!DebugSyms && (symflags & SymbolRef::SF_FormatSpecific))
298 continue;
That looks weird.
2. Symbol types look completely strange and different from what usual nm
returns:
lib/Object/MachOObjectFile.cpp indeed returns only "u" or "s" as a symbol type
(see MachOObjectFile::getSymbolNMTypeChar), while, for example,
include/llvm/Object/ELF.h has completely different logic (and thus llvm-nm
works much better and more like usual "nm" on Linux).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list