strip - 実行ファイルのサイズを減少
オブジェクトファイルからリロケート情報とシンボルテーブルのデバッグ用の 情報を削除することで実行ファイルのサイズを減少させることができます。
% ls -l a.out -rwxr-xr-x 1 s1080134 student 5671 Oct 14 14:32 a.out* % file a.out a.out: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped % strip a.out % file a.out a.out: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped % ls -l a.out -rwxr-xr-x 1 s1080134 student 3172 Oct 14 14:33 a.out*
指定ディレクトリ以下のバイナリファイルをすべてstripするには
% find [path] -type f -perm +a=x | xargs file | fgrep -i `uname -p` | fgrep 'not stripped' | cut -d: -f1 | xargs strip
のようにするかもしれません。 実行許可のあるファイルを探し、file コマンドで情報を得て、'not stripped' かつ OS が実行環境と同じもの(会津大学には Solaris, IRIX その他があるため)に対してだけ strip しています。