This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ATTRIBUTE_WEAK
- To: law at cygnus dot com
- Subject: Re: ATTRIBUTE_WEAK
- From: hjl at lucon dot org (H.J. Lu)
- Date: Wed, 24 Feb 1999 10:02:51 -0800 (PST)
- Cc: egcs at egcs dot cygnus dot com
>
>
> It just occurred to me why you keep claiming ATTRIBUTE_WEAK is target
> dependent.
>
> It's the conditions under which ATTRIBUTE_WEAK is supported that is target
> dependent. Not the attribute itself or the fact that we want to use it
> in a target file..
>
> I think the way to go is to define/use TARGET_ATTRIBUTE_WEAK instead of
> ATTRIBUTE_WEAK to help make this clear. I still think this is fine for
> gansidecl.h in the mainline sources.
>
> Sorry to have been so dense about this.
> jeff
>
Could you please show me how to use __attribute__ ((weak))? The code
below doesn't make "foo" weak. BTW,
#pragma weak foo
works fine.
Thanks.
--
H.J. Lu (hjl@gnu.org)
---
extern void foo () __attribute__ ((weak));
bar ()
{
if (foo) foo ();
}