Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top