Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you determine optimization level from file?

Tags:

object

linux

elf

I have a compiled elf file and I would like to verify the optimisation level used. The question is how can I determine optimisation level from an object/elf?

I have tried with "file" command and "objdump" (most of the switches), but none of them revealed this. Is it possible at all?

like image 489
tothphu Avatar asked Jan 04 '12 02:01

tothphu


2 Answers

strings foo.o | grep -- -O might give you what you want.

like image 67
Trent Avatar answered Sep 20 '22 10:09

Trent


No, not in general. The compiler doesn't write its active "optimisation" setting to the object file, and it's not necessarily possible to determine from the object code itself.

like image 23
Greg Hewgill Avatar answered Sep 19 '22 10:09

Greg Hewgill