Support the different weakref semantic in GCC 4.2 and clang.

This commit is contained in:
joerg 2011-02-18 23:41:57 +00:00
parent cd8ce60348
commit e189b01ad3
1 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nsdispatch.c,v 1.34 2009/02/05 13:21:11 lukem Exp $ */
/* $NetBSD: nsdispatch.c,v 1.35 2011/02/18 23:41:57 joerg Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
@ -63,7 +63,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nsdispatch.c,v 1.34 2009/02/05 13:21:11 lukem Exp $");
__RCSID("$NetBSD: nsdispatch.c,v 1.35 2011/02/18 23:41:57 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -172,12 +172,15 @@ static mutex_t _ns_drec_lock = MUTEX_INITIALIZER;
/*
* Runtime determination of whether we are dynamically linked or not.
*/
#ifdef __ELF__
extern int _DYNAMIC __weak_reference(_DYNAMIC);
#define is_dynamic() (&_DYNAMIC != NULL)
#else
#ifndef __ELF__
#define is_dynamic() (0) /* don't bother - switch to ELF! */
#endif /* __ELF__ */
#elif __GNUC_PREREQ__(4,2)
static int rtld_DYNAMIC __attribute__((__weakref__, __alias__("_DYNAMIC")));
#define is_dynamic() (&rtld_DYNAMIC != NULL)
#else
extern int _DYNAMIC __weak_reference(_DYNAMIC);
#define is_dynamic() (&_DYNAMIC != NULL)
#endif
/*