This is the mail archive of the 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: Alignment of special common variables

On Wed, Jan 14, 2004 at 09:47:53PM +0200, Galit Heller wrote:
> Hi,
> Our port for NS CR16C defines special common variable sections, in a manner
> similar to MIPS's .scommon, using hook functions such as
> elf_backend_add_symbol_hook.
> We noticed that these special common variables aren't aligned correctly in the
> output, and, specifically -with -sort-common, they aren't sorted correctly,
> and traced the reason to the following test in elflink.h
> function elf_bfd_link_add_symbols:
>       /* Set the alignment of a common symbol.  */
>       if (isym->st_shndx == SHN_COMMON
>           && h->root.type == bfd_link_hash_common)
>         {
>           unsigned int align;
>           align = bfd_log2 (isym->st_value);
>           if (align > old_alignment
>               /* Permit an alignment power of zero if an alignment of one
>                  is specified and no other alignments have been specified.  */
>               || (isym->st_value == 1 && old_alignment == 0))
>             h->root.u.c.p->alignment_power = align;
>           else
>             h->root.u.c.p->alignment_power = old_alignment;
>         }
> Since the section index of these variables is a processor specific section
> index, and not SHN_COMMON, the condition isn't true, and thus the special
> common variables' alignment isn't set correctly (instead it's set to the
> size, by _bfd_generic_link_add_one_symbol).
> Has anyone experienced this problem on a platform which supports special
> common sections, and has a suggestion how to work around this ?

HPUX/IA64 has the similar problem with SHN_IA_64_ANSI_COMMON.


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