This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Please help with __attribute__ weak
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Dimitry Golubovsky <dimitry at golubovsky dot org>
- Cc: gcc at gcc dot gnu dot org, gcc-help at gcc dot gnu dot org
- Date: Tue, 26 Jul 2005 07:01:19 -0700
- Subject: Re: Please help with __attribute__ weak
- References: <42E61C4F.3090203@golubovsky.org>
On Tue, Jul 26, 2005 at 07:19:43AM -0400, Dimitry Golubovsky wrote:
>
> I need to declare a symbol which is weaker in the executable than in any
> external static or dynamic library.
>
> In other words, the executable provides some fallback function
> implementation (in my example, for "write"). But if the linker or
> dynamic linker resolves it, the symbol definition from an external
> library must be used.
>
The weak symbol is different from the normal one only during creating
executable or shared library if it is in a relocatable file. You
can't use weak symbol for your purpose. But you can mark your symbol in
shared library protected.
H.J.