A.out linux executable from which program?

Given the current directory with a lot of files and let me compile one file and generate the a.out executable . Now I want to find from which program this executable was generated. How can i do this?

+4
source share
2 answers

You can use readelf:

readelf -a a.out | grep FILE

For example:

$ gcc t.c
$ readelf -a a.out |grep FILE
    28: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    36: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    41: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS t.c
$ 

Alternatively you can use

objdump -t a.out |grep df

Example:

$ objdump -t a.out |grep df
0000000000000000 l    df *ABS*  0000000000000000              crtstuff.c
0000000000000000 l    df *ABS*  0000000000000000              crtstuff.c
0000000000000000 l    df *ABS*  0000000000000000              t.c
+10
source

You can use objdump:

> objdump -g a.exe

a.exe:     file format pei-i386

crt1.c:
cygming-crtbegin.c:
file.c:
tlssup.c:
CRTglob.c:
CRTfmode.c:
txtmode.c:
CRT_fp10.c:
cpu_features.c:
...
+3
source

All Articles