Is there any way to know which symbols are exported in a object file?

0 votes
asked Feb 5, 2010 by ana-pazos

Hi I'm working in a Linux environment and I have to link to a object file already compiled which offers me some services (services.o) and I know some of them, but I'd like to know which are all of the exported symbols of it.

Is there any way to accomplish this not having the sources? If so, how?

Thanks you very much.

3 Answers

0 votes
answered Jan 5, 2010 by joveha

Another option is objdump which also can show you a bunch of other stuff

0 votes
answered Feb 5, 2010 by dirkgently

Try nm -- this tool is there for just this purpose.

0 votes
answered Sep 15, 2017 by freeman

or you can use readelf -s, this provides more detail infos.

Symbol table '.symtab' contains 19 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS a.c
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    7 
     7: 0000000000000000     0 SECTION LOCAL  DEFAULT    8 
     8: 0000000000000000     0 SECTION LOCAL  DEFAULT    9 
     9: 0000000000000000     0 SECTION LOCAL  DEFAULT   11 
    10: 0000000000000000     0 SECTION LOCAL  DEFAULT   12 
    11: 0000000000000000     0 SECTION LOCAL  DEFAULT   14 
    12: 0000000000000000     0 SECTION LOCAL  DEFAULT   16 
    13: 0000000000000000     0 SECTION LOCAL  DEFAULT   17 
    14: 0000000000000000     0 SECTION LOCAL  DEFAULT   15 
    15: 0000000000000000    71 FUNC    GLOBAL DEFAULT    1 fa_global
    16: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    4 a
    17: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND fb_ex
    18: 0000000000000050    17 FUNC    GLOBAL DEFAULT    1 test
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...