Module Name:    src
Committed By:   joerg
Date:           Fri Feb 18 23:41:57 UTC 2011

Modified Files:
        src/lib/libc/net: nsdispatch.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/net/nsdispatch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/net/nsdispatch.c
diff -u src/lib/libc/net/nsdispatch.c:1.34 src/lib/libc/net/nsdispatch.c:1.35
--- src/lib/libc/net/nsdispatch.c:1.34	Thu Feb  5 13:21:11 2009
+++ src/lib/libc/net/nsdispatch.c	Fri Feb 18 23:41:57 2011
@@ -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);
-#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
 
 
 /*

Reply via email to