Liunxでダイナミックリンクライブラリシンボルが定義されていない問題を解決

2784 ワード

Liunxでダイナミックリンクライブラリシンボルが定義されていない問題を解決
ラベル(スペース区切り):テクノロジ
nm
さぎょう
バイナリ・プログラムのマイナス記号の値、記号タイプ、記号名などをリストします.
使用法
  • -A表示対象ファイル名
  • -C表示プログラムの元の名前
  • -Dダイナミックマイナス
  • を印刷
  • -u未定義の記号
  • を印刷する
    シンボルタイプ
    シンボルタイプ
    意味
    A
    この記号の値は、以降のリンクでは変更されません.
    B
    初期化されていないグローバル変数
    D
    初期化されたグローバル変数
    T
    グローバル非静的関数を表す
    U
    未定義の記号
    ldd
    さぎょう
    elfファイルの顔のsoダイナミックリンクライブラリを表示する
    リファレンス
    lddコマンドの概要
    gcc
    使用法
    –undefined symbols = method ignore-all
    Do not report any unresolved symbols. 
    
    report-all
    Report all unresolved symbols. This is the default. 
    
    ignore-in-object-files
    Report unresolved symbols that are contained in shared libraries, but ignore them if they come from regular object files. 
    
    ignore-in-shared-libs
    Report unresolved symbols that come from regular object files, but ignore them if they come from shared libraries. This can be useful when creating a dynamic binary and it is known that all the shared libraries that it should be referencing are included on the linker's command line.
    

    -z
    Report unresolved symbol references from regular object files. This is done even if the linker is creating a non-symbolic shared library. The switch --[no-]allow-shlib-undefined controls the behaviour for reporting unresolved references found in shared libraries being linked in.
    

    –allow-shlib-undefined/–no-allow-shlib-undefined
    Allows or disallows undefined symbols in shared libraries. This switch is similar to --no-undefined except that it determines the behaviour when the undefined symbols are in a shared library rather than a regular object file. It does not affect how undefined symbols in regular object files are handled.
    
    The default behaviour is to report errors for any undefined symbols referenced in shared libraries if the linker is being used to create an executable, but to allow them if the linker is being used to create a shared library.
    
    The reasons for allowing undefined symbol references in shared libraries specified at link time are that:
    
    A shared library specified at link time may not be the same as the one that is available at load time, so the symbol might actually be resolvable at load time.
    
    There are some operating systems, eg BeOS and HPPA, where undefined symbols in shared libraries are normal.
    
    The BeOS kernel for example patches shared libraries at load time to select whichever function is most appropriate for the current architecture. This is used, for example, to dynamically select an appropriate memset function.