Can you find out which compiler was used to compile a program?

前端 未结 7 642
迷失自我
迷失自我 2021-02-05 09:45

Given an executable that is compiled from C to run on Solaris, is it possible to determine which compiler was used to compile the associated incomplete executable?

I can

7条回答
  •  南旧
    南旧 (楼主)
    2021-02-05 10:23

    Not stripped:

    $ cc -O hello.c

    $ file a.out

    a.out: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped

    $ strings -a a.out | grep cc

    /opt/solarisstudio12.3/prod/bin/cc -O hello.c

    $ dwarfdump -i a.out | grep compile_o

    DW_AT_SUN_compile_options Xa;O;R=Sun C 5.12 SunOS_sparc Patch 148917-07 2013/10/18;backend;raw;cd;

    Stripped:

    $ strip a.out

    $ file a.out

    a.out: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, stripped

    $ strings -a a.out | grep cc

    (none)

提交回复
热议问题