Subject: Re: CVS commit: src/lib/csu/i386_elf
To: David Laight <david@l8s.co.uk>
From: Jason Thorpe <thorpej@shagadelic.org>
List: source-changes
Date: 05/17/2006 14:43:11
On May 17, 2006, at 2:39 PM, David Laight wrote:

> On Wed, May 17, 2006 at 02:14:38PM -0700, Jason Thorpe wrote:
>
>> Way too much weak function grief.
>
> How about:
> #if __GNUC_PREREQ__(4, 0)
> #define __weak_reference(sym)      __attribute__((__weakref__))
> #else
> #define __weak_reference(sym)      ; __asm(".weak " _C_LABEL_STRING 
> (#sym))
> #endif
>
> So you do:
>
> int weak_fn(void) __weak_reference(weak_fn);

Slightly ugly because we duplicate the name twice.... but I guess  
it's OK.

> I just dislike #if's in code so much :-)
>
> 	David
>
> -- 
> David Laight: david@l8s.co.uk

-- thorpej