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: matz at suse dot de
Subject: [Bug ld/30499] reword "alignment ... is smaller than alignment ..." warning
Date: Tue, 06 Jun 2023 13:39:33 +0000

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

--- Comment #6 from Michael Matz <matz at suse dot de> ---
(In reply to Nick Clifton from comment #5)
> (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...)

Whoops, you are right.  My extended example was supposed to also make com1_ be
global.  Luckily most of what I said was correct even in that situation.  In
particular that ld still isn't able to align both, com1_ and com2_ to 0x40.
(It does then warn about both then, though).

So, ".globl com1_" in test1.s somewhere :-)

> > a) the suggested wording of the warning is wrong, as not achievable in the
> >    general case
> 
> Presumably you mean the suggested new wording ?

Yes.

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

If it's easy to figure out, yes.  When I looked at the code where the warning
is currently emitted it wasn't immediately clear to me which final alignment
will be chosen (especially considering that the larger one won't always be
possible).

> > 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.

Yes.  I always thought that the very existence of the warning already
indicated that something potentially problematic was going on :-)  Can't
be bad to be even clearer about this, though.

-- 
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]