Detect GCC compile-time flags of a binary

前端 未结 4 2032
谎友^
谎友^ 2020-11-30 08:42

Is there a way to find out what gcc flags a particular binary was compiled with?

4条回答
  •  春和景丽
    2020-11-30 09:24

    Experimental proof:

    diciu$ gcc -O2 /tmp/tt.c -o /tmp/a.out.o2
    diciu$ gcc -O3 /tmp/tt.c -o /tmp/a.out.o3
    diciu$ diff /tmp/a.out.o3 /tmp/a.out.o2 
    diciu$
    

    I take that as a no as the binaries are identical.

提交回复
热议问题