This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/12246: BFD linker plugin generates incorrect alignments for common symbols
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Sat, 20 Nov 2010 09:33:08 -0800
- Subject: Re: PATCH: PR ld/12246: BFD linker plugin generates incorrect alignments for common symbols
- References: <20101120160422.GA22747@intel.com>
On Sat, Nov 20, 2010 at 8:04 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> For ELF common symbols, st_value holds the symbol alignment. ?Since
> plugin doesn't care about alignment of common symbol, we should just
> use 1 byte alignment. Linker will pick the alignment from the real common
> symbol. ?OK for trunk?
I am checking it in as an obvious fix.
H.J.
----
> Thanks.
>
>
> H.J.
> ---
> 2010-11-20 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?PR ld/12246
> ? ? ? ?* plugin.c (asymbol_from_plugin_symbol): Set alignment of
> ? ? ? ?common symbol to 1 for For ELF targets.
>
> diff --git a/ld/plugin.c b/ld/plugin.c
> index 79b39e8..c4337d9 100644
> --- a/ld/plugin.c
> +++ b/ld/plugin.c
> @@ -292,6 +292,9 @@ asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym,
> ? ? ? flags = BSF_GLOBAL;
> ? ? ? section = bfd_com_section_ptr;
> ? ? ? asym->value = ldsym->size;
> + ? ? ?/* For ELF targets, set alignment of common symbol to 1. ?*/
> + ? ? ?if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
> + ? ? ? ((elf_symbol_type *) asym)->internal_elf_sym.st_value = 1;
> ? ? ? break;
>
> ? ? default:
>
--
H.J.