nmの見方について(翻訳は適当)

080487c0 T _start
080493ec T append
         U atoi@@GLIBC_2.0
0804be8c B bufend
080493a9 T buffalloc
0804be98 B bufp
080487e4 t call_gmon_start
08048fdd T check
         U clearerr@@GLIBC_2.0
08049455 T compare
0804be50 b completed.1
0804bb80 d copyright
0804bcc0 D dakuon

こんなやつの見方.

これは各行が,ひとつのシンボルを表し,

値 シンボルタイプ シンボル名

の順に並んでおり、

  • 値は16進がデフォルト(オプションで切り替え可).
  • 基本的にシンボルタイプを表すアルファベットはセクション名を表す.(詳細は以下)
  • 小文字の場合はローカルシンボル,大文字はグローバルシンボルであることを表す.

良く見かけるシンボルタイプ

  1. A 絶対値
  2. B bssセクション(初期値を持たない広域変数)
  3. D dataセクション(初期値を持つ広域変数)
  4. T textセクション
  5. U シンボルは未定義

シンボルタイプ(載ってないものはファイルフォーマット依存のものだと思う)

  • A

シンボルの値は絶対値.リンキングによって値が変わらない.

  • B

シンボルはBSSセクション(初期化されないデータ)にある.

  • C

シンボルはcommon.commonシンボルは初期化されないデータである.リンキングのとき,複数のコモンシンボルが同じ名前で現れる.もしシンボルがどこかで定義されていたら,コモンシンボルは未定義の参照として扱われる(??).

  • D

シンボルは初期化されるデータセクションにある(dataセクション).

  • G

シンボルは小さなオブジェクトのための初期化データセクション(sdataセクション?)にある.(オブジェクトファイルフォーマットによっては小さなグローバルオブジェクト(グローバルのint変数など)に特化した効率的なアクセス方法を提供するものがある)

  • I

シンボルは他のシンボルのための間接参照.(これはGNUのa.outのファイルフォーマットのための拡張である)

  • N

シンボルはデバッギングシンボルである.

  • R

シンボルはread onlyデータセクションにある.

  • S

シンボルは小さなオブジェクトのための初期化なしデータセクション(sbssセクション?)にある.

  • T

シンボルはtextセクションにある.

  • U

シンボルは未定義.

  • 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.

  • ?

シンボルタイプは不明,もしくはオブジェクトファイルフォーマット特有のもの.

  • *

シンボル名.