This is the mail archive of the binutils@sourceware.org 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: ld Warnings reference? particularly "Warning: type of symbol ... changed from X to Y"


"Oleg V. Zhylin" <ovz@yahoo.com> writes:

>   Is there a reference of ld Warnings somewhere?

Not that I know.  I agree that that would be helpful.

> When building my
> project I've encountered a warning like this
>
>>> ld: Warning: type of symbol `<Some name>' changed from 2 to 1 in 
>>> <lib name>(<obj name>)
>
>   It would be good to be able to look the warnings up for more details.
> But the very least I would like to find out what this particular
> warning means?

It means that <Some name> was found to be a variable, and then was
later found to be a function.  This is not always in every single case
an error, but it is awfully suspicious.  For example, you will get
that warning if you link these two files together.

==================================================
int foo;
int bar() { return foo; }
==================================================

==================================================
void foo() { }
int main() { return 0; }
==================================================

Here the type of foo changes from 1 (STT_OBJECT) in the first file to
2 (STT_FUNC) in the second file.  This is not an automatic error
because the "foo" in the first file is a common symbol which turns
into a reference to the define symbol "foo" in the second flie.

Ian


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