ld Warnings reference? particularly "Warning: type of symbol ... changed from X to Y"
Ian Lance Taylor
iant@google.com
Sat Mar 29 04:11:00 GMT 2008
"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
More information about the Binutils
mailing list