This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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] Let plugins know the final size of common symbols


I just realized the problem runs a bit deeper. Combining a file with
".comm   a,4,8" with another with ".comm   a,8,4" should produce a
symbol a that is 8 bytes big and 8 bytes aligned. We don't even have a
field to pass back the alignment info to the plugin.

What I think could work is

* The plugin ignores the gold provided resolution for common symbols
and just resolves all the IR common symbols.
* The linker receives the result of the IR resolution and merges that
with any native file.

I will give that a try.


On 8 September 2014 17:18, Rafael EspÃndola <rafael.espindola@gmail.com> wrote:
> When resolving common symbols, gold will always keep the first one it
> finds. It will then patch the size if a larger one shows up. This is
> fine, but this information is currently never passed to the plugin
> which may end up producing a final .o file with a symbol that is too
> small.
>
> The attached patch changes Pluginobj::get_symbol_resolution_info to
> set the size of  ld_plugin_symbol in addition to the resolution. With
> this information the plugin can then update its view on the common
> symbol and produce an ELF file where the symbol has the correct size.
>
> Cheers,
> Rafael
>
>
> 2014-07-08  Rafael Ãvila de EspÃndola <rafael.espindola@gmail.com>
>
>         * plugin.h (Sized_pluginobj::do_get_symbol_resolution_info): Moved from
>         Pluginobj.
>         * plugin.cc (Sized_pluginobj::do_get_symbol_resolution_info): Update the
>         symbol size.


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