Re: can we find the optimization level from obj-file?

Marco van de Voort <>
1 Nov 2005 00:24:59 -0500

          From comp.compilers

Related articles
can we find the optimization level from obj-file? (Jatin Bhateja) (2005-10-26)
Re: can we find the optimization level from obj-file? (Marco van de Voort) (2005-11-01)
| List of all articles for this month |

From: Marco van de Voort <>
Newsgroups: comp.compilers
Date: 1 Nov 2005 00:24:59 -0500
Organization: Stack Usenet News Service
References: 05-10-178
Keywords: assembler, practice
Posted-Date: 01 Nov 2005 00:24:59 EST

On 2005-10-26, Jatin Bhateja <> wrote:
> Now after the assembler converts it into objcode than can it be
> determined at that time to which level that code is optimized
> Though according to me it's not possible but I need your suggestions
> on that.

> [I would think that for a particular compiler and target system, you could
> find patterns generated by each opt level, but in general it seems like a
> hopeless waste of time. -John]

If the binary mustn't be extremely tight, simply add the compiler
options used as a string in the binary.

If not, as John says, you can implement heuristics, but these are horribly
compiler, level, target and (even minor!) version dependant

Moreover, with compilers like gcc, the levels are only global, and more
finegrained control over optimization (on a per specific optimization basis)
is usually possible.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.