This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Link time checking for incompatible flags
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Rahul Joshi <rujoshi at uiuc dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: 21 Apr 2004 21:24:52 -0400
- Subject: Re: Link time checking for incompatible flags
- References: <7a9f7a95.345d404b.81a0100@expms3.cites.uiuc.edu>
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