This is the mail archive of the gcc-patches@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: [plugins] checking the compiler version


On Wed, 8 Apr 2009, Rafael Espindola wrote:

> I started working on how to check that a plugin is compatible with the
> compiler loading it.
> 
> Since it is the plugin that knows its needs, my strategy is for the
> compiler to pass its version to plugin_init and let the plugin decide.

I think the compiler should check, not the plugin; the plugin cannot 
possibly know if the definition of a GCC-internal interface will change in 
future in a way that requires the plugin to be rebuilt.  So plugins should 
export the information about versions needed (for example, if you use the 
checksum approach GCC could provide an object file to be linked into all 
plugins that gives the checksums, in addition to such an object being 
linked into GCC itself).

> The question is what to pass. BASEVER is a natural candidate, but I
> would expect most plugins to depend on more fine grained things. Any
> change to one of the structures used in tree will probably break most.
> Something similar to the pre-compiled headers checksums should be
> helpful. The problem is that each compiler (cc1, cc1plus, etc) has a
> different checksum and we might want to have a plugin that works both
> with cc1 and cc1plus.

Checksums are certainly a sufficient test, but checking version_string 
(the full version, not just BASEVER) and configuration_arguments (from 
configargs.h) would probably cover most cases.

In particular, configuration_arguments will ensure you don't use a plugin 
for one target with a compiler for another target (but the same host) as 
well as avoiding issues when the configure options affect the 
HOST_WIDE_INT definition.

-- 
Joseph S. Myers
joseph@codesourcery.com


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