This is the mail archive of the binutils@sources.redhat.com 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]

Re: "Warning: size of symbol FOO changed from X to Y in OBJ"


"H . J . Lu" <hjl@lucon.org> writes:

> On Thu, May 31, 2001 at 12:25:21AM -0700, Ian Lance Taylor wrote:
> > "H . J . Lu" <hjl@lucon.org> writes:
> > 
> > > BTW, I believe "Warning: size of symbol FOO changed from X to Y in OBJ"
> > > is a fatal error if X > Y.
> > 
> > That is not clear to me.  For cases where this warning arises, the
> > linker is not going to take any action based on the symbol size.  The
> > linker only uses the symbol size for common symbols, and changes in
> > common symbol size are handled in a different way.
> 
> I thought the warning was for common symbol. In any case, if you
> override a definition with another one of a smaller size, I believe
> something will go wrong if some code still uses the larger size.

That warning is not for common symbols.  Merging of common symbols is
handled in elf_merge_symbol, and that sets size_change_ok, which
prevents the above warning.

The symbol size only has an actual effect for common symbols and for
symbols which are the subject of a COPY relocation.  In other cases,
as in the size of a function, the symbol size is only a comment.
Since nothing uses the size, it doesn't matter which size appears in
the executable.

I suppose it's conceivable that setting the symbol size to the smaller
size could cause a bug.  But I can't think of any case in which that
would happen.  So I would want more than speculation.

Ian


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