I am using CentOS 6.02 64 bit. I want to see the information and used compiler flags in .o files. Is there any command or way to see that? I have seen the architecture of .a file by using objdump. But couldn't seen the information for .o files.
1 に答える
0
オブジェクト ファイルからコンパイラ フラグを抽出する一般的な方法はありません。これは、-fverbose-asm (asm の生成にのみ影響する gcc フラグ) などの no-op スイッチを使用して、または使用せずに 2 回コンパイルし、オブジェクトを比較することで確認できます。オブジェクトは同一です。ただし、コンパイル中にそれらを挿入できるコンパイラ固有の拡張機能がいくつかあります。たとえば-frecord-gcc-switches
、新しいバージョンの gcc では、セクションで使用されるフラグを配置します.GCC.command.line
。さまざまなコンパイラによって .comment セクションに挿入されるさまざまな情報もあります。たとえば、gcc 4.7.2 でコンパイルすると次のようになります。
$objdump -s -j.comment <objfile>
objfile: file format elf64-x86-64
Contents of section .comment:
0000 00474343 3a202847 4e552920 342e372e .GCC: (GNU) 4.7.
0010 3200 2.
もちろん、.a ファイルと同じ方法でアーキテクチャを取得できますobjdump -f
。
于 2013-02-14T07:59:01.190 に答える