c/2678: gcc/g++ should stick compilation options into the .o file

rfg@monkeys.com rfg@monkeys.com
Sat Apr 28 13:46:00 GMT 2001


>Number:         2678
>Category:       c
>Synopsis:       gcc/g++ should stick compilation options into the .o file
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 28 13:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ronald F. Guilmette
>Release:        gcc-2.95.2
>Organization:
>Environment:

>Description:
It would be Really Nice if the gcc and g++ compilers, when
compiling for some ELF target (at least) would stick a
copy of ALL of the compilation options used during the
compile into an ELF .comment or .note section within the
resulting .o file.

I wish I had a nickle for every time I had a .o file, left
over from some build I did a long long time ago (in a galaxy
not far away) and I was stuck saying to myself ``I wish I
knew what options this thing had been compiled with.  I wonder
if it was optimized.''

The ELF object file format provides a couple of obvious means
(.command and .note sections) for recording this exact infor-
mation into each .o file.  And I don't think that it would
be very hard to get the front-end gcc/g++ driver to pass
ALL compilation options down to cc1 and/or cc1plus.  They
in turn could easily still the options into a suitable ELF
section.

Note that this would also allow for some potentially inter-
esting types of retrospective automated analysis of .o files.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list