This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld Warnings reference? particularly "Warning: type of symbol ... changed from X to Y"
- From: Ian Lance Taylor <iant at google dot com>
- To: "Oleg V. Zhylin" <ovz at yahoo dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 28 Mar 2008 21:11:14 -0700
- Subject: Re: ld Warnings reference? particularly "Warning: type of symbol ... changed from X to Y"
- References: <382977.12305.qm@web56605.mail.re3.yahoo.com>
"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