ld and common symbols

Roland McGrath roland@frob.com
Tue Dec 21 15:44:00 GMT 1999


> I think we would all agree that if t2.c had contained this line:
> 
>   int bar = 2;
> 
> then the linker would have been justified in issueing the error about
> a multiply defined symbol.  I am not sure however, what the concessus
> will be for the correct behaviour in the case you outline above.
> Persoanlly I think the linker is doing the right thing in complaining,
> since bar ought to only be defined and initlaised in one palce, and
> the other files ought to just contain references to it.

Sorry, you are just completely wrong.  This is what common definitions
(i.e. uninitialized C variables) have always done.  Didn't we just cover this?


More information about the Binutils mailing list