This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Link time checking for incompatible flags


Rahul Joshi <rujoshi@uiuc.edu> writes:

> A few days back, I had a hard time debugging my code, and the 
> reason was that I was linking code compiled with -fshort-enums
> with code not compiled using that flag. It would have been
> great if linker had somehow figured out the discepancy and
> issued a warning. Would it be possible to add such link-time
> checking for incompatible compiler options?

This is not a compiler issue.  It is a linker issue.  The compiler
might be involved in a solution, but ultimately this issue would have
to be addressed in the linker.

The linker currently has no mechanism for anything like this.  It
would be possible in principle to record options with compatibility
issues in a note section.  The linker could then look at the note
sections in the various input files, and report on incompatibilities.
Perhaps the section would contain strings like "short-enums=1" or
"short-enums=0".  If two input files both contained "short-enums=" and
the values differed, the linker would issue a warning.

Perhaps you should open an enhancement PR.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]