This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Let plugins know the final size of common symbols
- From: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- To: binutils at sourceware dot org
- Cc: Cary Coutant <ccoutant at google dot com>
- Date: Mon, 8 Sep 2014 20:53:18 -0400
- Subject: Re: [patch] Let plugins know the final size of common symbols
- Authentication-results: sourceware.org; auth=none
- References: <CAG3jReLkCdYiaCtGjUNMW7kJPMKrLxMCgznU9j29r6qvUi_0ZA at mail dot gmail dot com>
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.