Does GCC record optimization information into binary file?

Qing Zhao qing.zhao@oracle.com
Thu Jan 29 16:08:46 GMT 2026



> On Jan 29, 2026, at 04:00, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> 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.

Okay, that’s good to know. So, user can examine the debug section in binary to get the inlining information?

How about the profiling information, especially which routines are optimized by using the profiling info? Is such info recorded in binary?

>  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.).

Our internal customer is specially interested in recording whether the profiling information is used by the optimization into binary. 

Qing

> 
> Jakub
> 



More information about the Gcc mailing list