This is the mail archive of the
mailing list for the GCC project.
Re: [patch][plugins] Check the gcc version
> Cool! Where do we install the gcc headers? under <prefix>/include? I
> couldn't seem to be able to find it in my top of trunk mainline
> install directory.
>> Plugins only have to link if they want to check the gcc version. I
>> used an object file mostly because it was easy. The only tricky bit is
>> that, other then using hidden symbols, the only way for gcc to get the
>> plugin version is with dlsym.
> I think my point is that a plugin should not need to link in
> plugin-version.o in order to check the gcc version. The model that I
> was thinking is that GCC will pass its version information to the
> plugin (as a parameter to plugin_init function like what you are doing
> now), and the plugin will then check whether the given GCC version is
> compatible with its requirement. If not, the plugin will emit a
> warning and the initialization will fail.
For most plugins the requirements will be "the gcc I was build for".
To find that we
have to construct a header that the plugin can use or have it link
with an object. Since
I was already building the object for gcc itself, it was easy to use
on the plugin.
I will try to build a header and post a patch.
> Based on the model I mentioned above, there is no symbol visibility
> issue between GCC proper and the plugins. Version information is
> communicated between GCC and the plugins by function parameter. In
> GCC, we first construct a version object (as you are doing now), and
> pass it to the plugin during initialization (as shown in the
> if-statement above, although we might want to change the object name
> from plugin_gcc_version to simply gcc_version). The plugin then checks
> the given GCC version and decide whether it's compatible or not.
Sure. The hard part is for the plugin to decide if it is compatible or
not. For that
most plugins will want to know the gcc version they were compiled with.
> What do you think?
I will try to write a patch to use only headers.
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047