Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net Support the different weakref semantic in GCC 4...



details:   https://anonhg.NetBSD.org/src/rev/9769fd5943c0
branches:  trunk
changeset: 762302:9769fd5943c0
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Feb 18 23:41:57 2011 +0000

description:
Support the different weakref semantic in GCC 4.2 and clang.

diffstat:

 lib/libc/net/nsdispatch.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (39 lines):

diff -r 8f1319d10347 -r 9769fd5943c0 lib/libc/net/nsdispatch.c
--- a/lib/libc/net/nsdispatch.c Fri Feb 18 23:38:58 2011 +0000
+++ b/lib/libc/net/nsdispatch.c Fri Feb 18 23:41:57 2011 +0000
@@ -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 @@
 /*
  * Runtime determination of whether we are dynamically linked or not.
  */
-#ifdef __ELF__
-extern int                     _DYNAMIC __weak_reference(_DYNAMIC);
+#ifndef __ELF__
+#define        is_dynamic()            (0)     /* don't bother - switch to 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)
-#else
-#define        is_dynamic()            (0)     /* don't bother - switch to ELF! */
-#endif /* __ELF__ */
+#endif
 
 
 /*



Home | Main Index | Thread Index | Old Index