Linker can't resolve any references

Bob Cowdery bob@bobcowdery.plus.com
Wed Jun 23 17:39:00 GMT 2010


Ian Lance Taylor wrote:
> Bob Cowdery <bob@bobcowdery.plus.com> writes:
>
>   
>> I had read that and I was quite careful to ensure the correct order. I
>> did a test with just two libraries where the second referenced the first
>> and as in my follow-up message it didn't pull them in unless I made a
>> call into each from my main code. It's like the symbol tables are messed
>> up somehow.
>>     
>
> If your main program has a call into the first library, and the object
> required to satisfy that call has a call into the second library, then
> the linker should certainly pull in the required object from the
> second library.
>
> Can you provide a small standalone example of the problem?
>
> Ian
>   
Ian

Having read a bit more I think the behavior is correct. The libraries I
use are threaded and therefore there is often not a direct reference
from a call in the main code through one library to another. Having said
that, the two test libraries I choose do have direct calls. The linker
does seem to want to resolve dangling references as it works down the
library list rather than build a table as it goes and hook things up
later, so going strictly by the rules it won't even pull it in the
situation you give above. Do you still think that behavior is incorrect?

Bob



More information about the Gcc-help mailing list