[patch] .comm & alignment bug

Denis Chertykov denisc@overta.ru
Thu Aug 24 09:02:00 GMT 2000


Nick Clifton <nickc@redhat.com> writes:


[...]

> I agree that this is a bug, but I think that the patch you are
> proposing is wrong since if no alignment was specified for the symbol
> 'sym.st_value' will be 0, which will result in 'align' being zero (*),
> which will cause 'alignment_power' to be set to zero (assuming
> old_alignment is also zero).  This is incorrect since the spec says
> that if no alignment is specified its alignment will be:
> 
>   ... the largest power of two less than or equal to the size of the
>   symbol, up to a maximum of 16.

Generally I'm agree with you, but:
gas info says:

................................... If no alignment is specified, `as'
will set the alignment to the largest power of two less than or equal
to the size of the symbol, up to a maximum of 16.

So, assembler calculates default alignment.
As I understand `sym.st_value' can't be 0 in link time.

> Instead I would suggest the following, which is only slightly
> different, and which should have the desired effect whilst making it
> clear that 'align' is overriding the default alignment because an
> alignment of 1 was requested and there are no other definitions of the
> symbol with greater alignment requirements.
> 
> Please could you test this and let me know if it works for you.  If it
> does then I will check the patch in.

Your modified patch works.
Please apply.

Denis.

PS:
> (*) bfd_log2 (0) == bfd_log2 (1) == 0 !!!

IMHO: bfd_log2 (0) not happened in link time.



More information about the Binutils mailing list