bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/30499] reword "alignment ... is smaller than alignment ..." warn


From: nickc at redhat dot com
Subject: [Bug ld/30499] reword "alignment ... is smaller than alignment ..." warning
Date: Tue, 06 Jun 2023 10:43:53 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30499

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |nickc at redhat dot com
             Status|NEW                         |ASSIGNED

--- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Michael Matz from comment #4)

> % cc ...
> ld: warning: alignment 32 of symbol `com2_' in test2.o is smaller than 64 in
> test1.o
> 
> Note how it complains only about one, not both, symbols.  And further:

I think that this is because com2_ is a global symbol, whereas com1_ is local
in test2.o and global in test1.o.  (If you look you should see two definitions
of com1_ in the symbol table...)


> So, all in all, ultimately I think:
> a) the suggested wording of the warning is wrong, as not achievable in the
>    general case

Presumably you mean the suggested new wording ?

Maybe the warning message should explicitly indicate which alignment has been
chosen ?


> b) the above example shows how the warning might even be regarded as error.
>    Code that assumes 64-alignment for com1_ and com2_ (as requested by
> test1.o)
>    _will_ break with the generated output and there's no way for the linker
>    to magically make it work.
> 
> In the interest of backward compatibility and in light of the existence of
> -fcommon for C, even though its default changed a couple years back, which
> makes mixture of common and data symbols be somewhat common, I'm not actually
> suggesting to make this an error, though.

Agreed - but it might be worthwhile extending the warning message to emphasize
that the discrepancy could cause problems.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]