最終更新:2019-10-06 (日) 13:18:03 (1664d)  

strip
Top / strip

オブジェクトファイルからシンボルを切り捨てる

オプション

デバッグシンボル

  • .debug_aranges?
  • .debug_info?
  • .debug_abbrev?
  • .debug_line?
  • .debug_str?

内部

  • enum strip_action
    {
      STRIP_UNDEF,
      STRIP_NONE,		/* Don't strip.  */
      STRIP_DEBUG,		/* Strip all debugger symbols.  */
      STRIP_UNNEEDED,	/* Strip unnecessary symbols.  */
      STRIP_NONDEBUG,	/* Strip everything but debug info.  */
      STRIP_DWO,		/* Strip all DWO info.  */
      STRIP_NONDWO,		/* Strip everything but DWO info.  */
      STRIP_ALL		/* Strip all symbols.  */
    };

  • strip --strip-debug fs/cifs/cifs.ko

メモ

  • objcopy and strip in one binary that uses argv[0] to decide its action.

デバッグシンボル

  • プログラムやライブラリの多くは、デフォルトではデバッグシンボルを含めてコンパイルされています。 (gcc の -g オプションが用いられています。)
  • デバッグ情報を含めてコンパイルされたプログラムやライブラリは、デバッグ時にメモリアドレスが参照できるだけでなく、処理ルーチンや変数の名称も知ることができます。
  • gcc -g

man

  •        -s
           --strip-all
               Remove all symbols.
    
           -g
           -S
           -d
           --strip-debug
               Remove debugging symbols only.
    
           --strip-dwo
               Remove the contents of all DWARF .dwo sections, leaving the remaining debugging sections and all symbols intact.  See the description of this option in the objcopy section for more information.
    
           --strip-unneeded
               Remove all symbols that are not needed for relocation processing.

ld

  •        -s
           --strip-all
               Omit all symbol information from the output file.
    
           -S
           --strip-debug
               Omit debugger symbol information (but not all symbols) from the output file.
    

objcopy

  •                [-S|--strip-all]
                   [-g|--strip-debug]
                   [-K symbolname|--keep-symbol=symbolname]
                   [-N symbolname|--strip-symbol=symbolname]
                   [--strip-unneeded-symbol=symbolname]
                   [-G symbolname|--keep-global-symbol=symbolname]
                   [--keep-symbols=filename]
                   [--strip-symbols=filename]
                   [--strip-unneeded-symbols=filename]
           -S
           --strip-all
               Do not copy relocation and symbol information from the source file.
    
           -g
           --strip-debug
               Do not copy debugging symbols or sections from the source file.
    
           --strip-unneeded
               Strip all symbols that are not needed for relocation processing.
    

関連