Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/lib/csu/i386_elf
On Wed, May 17, 2006 at 01:30:29PM -0700, Jason Thorpe wrote:
>
> On May 17, 2006, at 1:12 PM, Christos Zoulas wrote:
>
> >You need to __attribute__((__weakref__)) all such symbols, and then it
> >works again :-)
>
> I would suggest the following, then:
>
> Define a new macro in cdefs_elf.h:
>
> #if __GNUC_PREREQ__(4, 0) /* or whatever version __weakref__ first
> appeared */
> #define __weak_reference __attribute__((__weakref__))
> #define __weak_extern(sym) /* nothing - deprecated - will
> remove in NetBSD 5.0 */
> #else
> #define __weak_reference /* nothing */
> #define __weak_extern(sym) __asm(".weak "_C_LABEL_STRING(#sym));
> #endif
>
>
> Find all the places that use __weak_extern(). Change them from:
>
> extern int _DYNAMIC;
> __weak_extern(_DYNAMIC);
>
> to:
>
> extern int _DYNAMIC __weak_reference;
> #ifdef __weak_extern
> __weak_extern(_DYNAMIC);
> #endif
Why not:
#if __GNUC_PREREQ__(4, 0)
#define __weak_reference(t, n) extern t n __attribute__((__weakref__))
#else
#define __weak_reference(t, n) extern t n; __asm(".weak "_C_LABEL_STRING(#n))
#endif
so the code just becomes:
__weak_reference(int, _DYNAMIC);
(Or does this cause too much grief with weak functions?)
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index