This is the mail archive of the 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: [patch][plugins] Check the gcc version

> Sorry for my late comments. (But better late than never, right? :-))

Very true :-)

> I really don't think we should ask individual plugins to link against
> this file. The plugins should require (and depend on) the access to
> the GCC header files only (which in the future should be packaged and
> installed with GCC distribution).

We are already installing the headers :-)

> If a plugin needs to link against a
> GCC .o file, the plugin support will become too messy (and very weird
> because, after all, GCC will link dynamically against the plugins) .

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.

What makes using an object file easy is that we can build it the same
way we build version.o: just use -D options. A header file to be used
by the plugins would have to be constructed at gcc build time. Now
that I think of it, it can probably be done with just "gcc -E -D...".
I will give it a try.

>> + ÂPTR_UNION_AS_VOID_PTR (version_union) =
>> + Â Â Âdlsym (dl_handle, str_plugin_gcc_version_name);
>> + Âversion = PTR_UNION_AS_CAST_PTR (version_union);
>> +
>> Â Â/* Call the plugin-provided initialization routine with the arguments. Â*/
>> - Âif ((*plugin_init) (plugin->base_name, plugin->argc, plugin->argv))
>> + Âif ((*plugin_init) (plugin->base_name, version, plugin->argc, plugin->argv))
>> Â Â Â{
> Passing the version you dlsym'ed from the plugin back to the plugin
> seems wrong to me. What we want to do is pass the current GCC version
> to the plugin, and the plugin can either check it against the version
> it desires/requires, or simply ignore this parameter and call
> plugin_default_version_check() with the version it requires. So I
> think we should remove the call to dlsym for
> str_plugin_gcc_version_name and change the if-statement Âto
> Âif ((*plugin_init) (plugin->base_name, &plugin_gcc_version,
> plugin->argc, plugin->argv))

For that to work I would have to use hidden visibility. With normal
elf visibility both the plugin and gcc would see the same symbol.

> Thanks,
> Le-chun

Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047

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