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 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

...so that code can continue to build with the old compiler for one more cycle and continue to build without the compatibility definition after 5.0.

(I'm assuming that __weakref__ will take care of doing the ".weak sym" dance in the assembly code for you...)

-- thorpej




Home | Main Index | Thread Index | Old Index