nm is a POSIX tool that displays symbol names and other such information of an object file to stdout
Questions tagged [nm]
230 questions
59
votes
2 answers
What is your favorite disassembler tool in Mac OS X?
I am using the otool, nm and Fraise text editor to disassemble the Mach-o binaries. My workflow at this point is pretty straightforward:
1. List the existed symbols.
nm -g
2. Get the disasm code.
otool -vt
3. Copy and paste this output to a…
user663896
41
votes
3 answers
Microsoft equivalent of the nm command
I've long used cygwin's nm command for all my .lib symbol debugging needs, but recently I thought about referring to it in a SO answer and realized that most Windows developers don't have cygwin installed.
So what is the Microsoft equivalent to nm,…

David Norman
- 19,396
- 12
- 64
- 54
36
votes
1 answer
nm vs "readelf -s"
Suppose we have a shared library named libtest.so, there is one function "foo" in it
use the strip to discards all symbols from libtest.so
$strip libtest.so
so ,now if we use:
$nm libtest.so
it will print out:
nm: libtest.so: no symbols
but if we…

camino
- 10,085
- 20
- 64
- 115
18
votes
2 answers
What does '_GLOBAL__sub_I_' mean in nm output?
While I was trying to resolve a problem in static linking, I encounter a couple of _GLOBAL__sub_I_ prefixes in front of symbol names. It appears in that form although I used nm --demangle(-C).
I stumbled upon this answer (How to find global static…

CremeBaldEagle
- 191
- 1
- 1
- 4
17
votes
1 answer
‘ldd -r’ equivalent on macOS
I am trying to make my software available on macOS, and in my toolchain I use the ldd -r MyModel.so command to verify that everything went well, but I can’t really find an equivalent command on macOS with the same behavior.
otool and nm seem to be…

Gautier Bureau
- 183
- 1
- 1
- 9
17
votes
1 answer
Why nm libc.so reports no symbols?
I've built a simple program like this:
g++ application.cpp -o application.exe
and then executed the command;
ldd application.exe
...
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
...
I want to list all the symbols of the libc library:
nm…

Alexey
- 710
- 3
- 7
- 19
16
votes
1 answer
What is the first column of nm output?
Thats my code:
int const const_global_init = 2;
int const const_global;
int global_init = 4;
int global;
static int static_global_init = 3;
static int static_global;
static int static_function(){
return 2;
}
double function_with_param(int…

Ice
- 1,783
- 4
- 26
- 52
14
votes
1 answer
Binding failure with objcopy --redefine-syms
Preconditions
A third-party has provided a C++ executable fooapp that uses a shared object libfoo.so. The library also comes with a header foo.hpp so developers can build other applications:
/* foo.hpp */
namespace foo {
void bar(int a, int b);
…

BrianTheLion
- 2,618
- 2
- 29
- 46
13
votes
2 answers
Difference between nm and objdump
Looking at the manuals, objdump and nm have overlapping features.
When would you use each one? What was the original purpose of each command?

Natan Yellin
- 6,063
- 5
- 38
- 57
12
votes
1 answer
Tool for Library Dependency
I'm looking for the tool/command on Unix platform to detect the library dependencies of the .so and .o files.
I have already used the ldd/nm/truss, but I don't know the proper approach to detect library dependencies.

Abinash Bishoyi
- 187
- 1
- 2
- 13
11
votes
3 answers
How to redirect llvm::outs() to file?
I'm using some LLVM tools (like llvm-nm) as static libraries. I.e. i copied source llvm-nm.cpp, renamed main(..) to llvm_nm(..) and compiled it as static library. I'd like to forward standard output to my file.
I've tried to use the next approach:
…

4ntoine
- 19,816
- 21
- 96
- 220
10
votes
1 answer
Is there a replacement for nm on Windows?
I would like to examine object files on Windows similar to the Linux tool nm. Is this possible?

lknfdhu
- 479
- 1
- 7
- 12
10
votes
1 answer
How are external symbols resolved?
I have two files 37064544_p1.cpp & 37064544_p2.cpp with the same content as shown below :
int add(int x,int y)
{
return x+y;
}
I compiled them using
g++ -c 37064544_p2.cpp -o 37064544_p2.o
g++ -c 37064544_p2.cpp -o 37064544_p2.o
and added them to…

sjsam
- 21,411
- 5
- 55
- 102
9
votes
3 answers
Strange symbol name in output of nm command
I built a dynamic lib called InterfaceLayer.so.
When I call:
> nm InterfaceLayer
As output, I get some symbols that look like:
00000e28 T _Z5startv
while I was expecting it to be "start", just as the name of the function I defined in the…

Lelo
- 854
- 11
- 25
9
votes
4 answers
How can I differentiate static functions with nm or readelf output in C
I am trying to process the output of a nm or readelf -s on an executable. However, I am having trouble differentiating static functions from each other in the output.
Here is what I am working with:
test.c
static int foo() {
int x = 6;
}
main()…

Andrew
- 1,355
- 2
- 13
- 28