Given a current directory with lots of files and let's say I compiled one file and generated executable a.out. Now, I want to find from which program this executable has been generated. How, can I do it?
You can use readelf:
readelf -a a.out | grep FILE
For instance:
$ 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
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With