最新消息:

linux nm命令

Linux admin 3506浏览 0评论

之前写了个库,用nm命令查看库文件。输出类似为:

0000159c A __bss_start
00000440 t __do_global_ctors_aux
00000350 t __do_global_dtors_aux
000014a8 d __dso_handle
         w __gmon_start__
00000407 t __i686.get_pc_thunk.bx
0000159c A _edata
000015a4 A _end
00000474 T _fini
000002b8 T _init
0000040c T backup
00000320 t call_gmon_start
000015a0 b completed.5791
0000159c b dtor_idx.5793
000003d0 t frame_dummy
         U login
         U logout

不清楚A,U,T,d,t等含义,上网搜了搜:

“A” The symbol’s value is absolute, and will not be changed by further linking.

“B” The symbol is in the uninitialized data section (known as BSS).

“C” The symbol is common. Common symbols are uninitialized  data. When linking, multiple common symbols may appear with the same name. If the symbol is defined anywhere, the common symbols are treated as undefined references.

“D” The symbol is in the initialized data section.

“G” The symbol is in an initialized data section for small objects. Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array.

“I” The symbol is an indirect reference to another symbol. This is a GNU extension to the a.out object file format which is rarely used.

“N” The symbol is a debugging symbol.

“R” The symbol is in a read only data section.

“S” The symbol is in an uninitialized data section for small objects.

“T” The symbol is in the text (code) section.

“U” The symbol is undefined.

“V” The symbol is a weak object. When a weak defined symbol is linked with a normal defined symbol, the normal defined  symbol is used with no error.  When a weak undefined symbol is linked and the symbol is not defined, the value  of  the  weak  symbol becomes zero with no error.

“W” The symbol is a weak symbol that has not been specifically tagged as a weak object symbol. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, the value of the symbol is determined in a system-specific manner without error. On some
systems, uppercase indicates that a default value has been specified.

“-” The symbol is a stabs symbol in an a.out object file. In this case,  the  next  values printed are the stabs other field, the stabs desc field, and the stab type.  Stabs symbols are used to hold debugging information.

“?” The symbol type is unknown, or object file format specific.

转载请注明:爱开源 » linux nm命令

您必须 登录 才能发表评论!