Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dump the symbols in a .a file

Tags:

c++

macos

Can you please tell me how can I dump all the symbols in a .a file on MacOS X?

I am getting a linking error while compiling my c++ problem on MacOS X. I would like to find out if the sybmols exists on the .a file that I am linking with.

Thank you.

like image 710
n179911 Avatar asked Jul 30 '09 00:07

n179911


People also ask

What is * und * In Objdump?

These characters are described below. Next is the section with which the symbol is associated or *ABS* if the section is absolute (ie not connected with any section), or *UND* if the section is referenced in the file being dumped, but not defined there.

What does the output of NM mean?

The nm commands provides information on the symbols being used in an object file or executable file. The default information that the 'nm' command provides is : Virtual address of the symbol. A character which depicts the symbol type.

What are symbols in object file?

Object files define and reference symbols, where each symbol corresponds to a function, a global variable, or a static variable (i.e., any C variable declared with the static attribute). The purpose of symbol resolution is to associate each symbol reference with exactly one symbol definition.


2 Answers

man nm

Nm displays the name list (symbol table) of each object file in the argument list. If an argument is an archive, a listing for each object file in the archive will be produced. File can be of the form libx.a(x.o), in which case only symbols from that member of the object file are listed. ... etc

like image 131
Sinan Ünür Avatar answered Oct 02 '22 10:10

Sinan Ünür


nm -g | c++filt

Mac nm doesn't have the demangle option, so you just run the output through c++filt (a demangler) afterwards.

like image 30
Tomeamis Avatar answered Oct 02 '22 10:10

Tomeamis