weak attribute

Quality Quorum qqi@theworld.com
Thu Jun 13 11:34:00 GMT 2002



On Thu, 13 Jun 2002, Alexander Gdalevich wrote:

> People, hello!
>
> According to the gcc manual 'weak' attribute is used for "defining library
> functions which can be overridden in user code".  However, functions whose
> implementation is provided in user code should be used regardless of the
> attribute of the corresponding library function...

Last time I tried it without 'weak' I got linking conflict.

>
> The problem I am having is that there are two implementations of
> __builtin_vec_new and __builtin_vec_delete one is in gcclib and the other is
> in the user library I provide.  The implementations in gcclib have 'weak'(W)
> attribute, whereas implementations in user library have normal attribute
> (T).
>
> What order does the linker searches the libraries?  Does it pull in the
> first implementaton it finds, or does it search all the available libraries?

It strongly depends upon linker script. E.g. you can specifiy
that particular set of libs to consitute group, then linker will search
through these libraries repetively trying to resolve as many references as
possible. Otherwise it is sequential process.

And you can always make a small experiment in order to find what is linker
doing.


>
> Thanks for the information.
>

Thanks,

Aleksey

>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
>


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list