Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command Line to see the contents Shared Object Module(lib*.so)

What is the command line to see the contents of a Shared Object module (lib*.so)?

Like how we use:

ar -t lib*.a 

for archives(lib*.a) and it displays all the object files in the library.

EDIT1

Example

ar -t lib*.a 

gives me a display:

asset.o

sldep.o

like image 499
Pavitar Avatar asked Sep 07 '10 05:09

Pavitar


People also ask

How do I view a .so file?

Instead, they're just placed in an appropriate folder and used automatically by other programs via Linux's dynamic link loader. However, you might be able to read the SO file as a text file by opening it in a text editor like Leafpad, gedit, KWrite, or Geany if you're on Linux, or Notepad++ on Windows.


1 Answers

use nm -D --defined-only libname.so to get the symbol names from your dynamic library.
The --defined-only switch shows you only the symbol that are defined in these files, and not references to external functions.

An alternative is to use objdump, and catch only the symbols in the text section :

objdump -T /usr/lib/libjpeg.so | grep text ... 0001b5c0 g    DF .text  00000016  Base        jdiv_round_up 00003730 g    DF .text  00000417  Base        jpeg_set_colorspace 0000cda0 g    DF .text  000002de  Base        jpeg_consume_input 00002b30 g    DF .text  00000023  Base        jpeg_abort_compress 00003b50 g    DF .text  000000b6  Base        jpeg_default_colorspace 00002810 g    DF .text  00000067  Base        jpeg_suppress_tables 00004110 g    DF .text  00000130  Base        jpeg_add_quant_table 000100c0 g    DF .text  0000011f  Base        jpeg_save_markers ... 
like image 60
shodanex Avatar answered Oct 07 '22 19:10

shodanex