Does GCC record optimization information into binary file?
Florian Weimer
fweimer@redhat.com
Thu Jan 29 10:30:41 GMT 2026
* Jakub Jelinek via Gcc:
> On Thu, Jan 29, 2026 at 09:49:40AM +0100, Richard Biener via Gcc wrote:
>> On Wed, Jan 28, 2026 at 4:43 PM Qing Zhao via Gcc <gcc@gcc.gnu.org> wrote:
>> > Does GCC provide any option to record optimization information, such as inlining, loop transformation,
>> > profiling consistency, etc into specific sections of binary code?
>>
>> No.
>
> Well, inlining is recorded in debug info. And I don't see what benefit
> woiuld be to encode the rest, without source information like that is not
> really useful and with source around you can always recompile and look for
> compiler dumps or opt info, debug info provides details how a particular
> TU has been compiled (with what options etc.).
It's hard to recompile in a generic fashion because build systems are so
varied. Depending on what people are trying to achieve, that's more of
a theoretical option.
(Capturing source code so that it becomes available for recompilation
would be interesting for many other applications, too.)
Thanks,
Florian
More information about the Gcc
mailing list