Get Information for Linux Library file


Get Information for Linux Library file

It can very helpful to troubleshoot a problem related to an application, if we can get information for linux library file.

Library file Info

You can get the information about a library file using nm command.

The command nm lists symbols contained in the object file or shared library.

The following is the syntax for the command.

nm -D /path/to/library_file.so

or

nm –dynamic /path/to/library_file.so

So if we want to check the library information for the library file /lib64/libcap.so, we can use the following command.

[[email protected] ~]# nm -D /lib64/libcap.so

The following is the sample output:

                 w _Jv_RegisterClasses
0000003d82203398 A __bss_start
                 U __ctype_b_loc
                 w __cxa_finalize
                 U __errno_location
                 w __gmon_start__
0000003d822032a0 D _cap_names
0000003d82203398 A _edata
0000003d82203618 A _end
0000003d82002448 T _fini
0000003d82000c68 T _init
0000003d82000e86 T _libcap_strdup
0000003d820017e2 T cap_clear
0000003d82001247 T cap_copy_ext
0000003d820013d7 T cap_copy_int
0000003d82000f26 T cap_dup
0000003d82000fa3 T cap_free
0000003d82001a4d T cap_from_text
0000003d820015c8 T cap_get_flag
0000003d820010a4 T cap_get_proc
0000003d82000e0c T cap_init
0000003d82001675 T cap_set_flag
0000003d820010e5 T cap_set_proc
0000003d82001238 T cap_size
0000003d82001fc9 T cap_to_text
                 U capget
0000003d82001146 T capgetp
                 U capset
0000003d820011bf T capsetp
                 U free
                 U malloc
                 U sprintf
                 U strcpy
                 U strtoul
                 U tolower

The following will explain the meaning for all the symbols mentioned above.

Symbol Type	Description
A		The symbol's value is absolute, and will not be changed by further linking.
B		Un-initialized data section
D		Initialized data section
T		Normal code section
U		Undefined symbol used but not defined. Dependency on another library.
W		Doubly defined symbol. If found, allow definition in another library to resolve dependency.

Alternatively, you can also use objdump command. The details on which I will write up later.

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.