Source-Changes-HG archive

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

[src/trunk]: src Introduce __weakref_visible to handle the different required...



details:   https://anonhg.NetBSD.org/src/rev/65d6cb66cc00
branches:  trunk
changeset: 762501:65d6cb66cc00
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Feb 22 05:45:05 2011 +0000

description:
Introduce __weakref_visible to handle the different required visibility
for weak references. GCC 4.2+ and Clang require static, older GCC wants
extern. Change __weak_reference to include sym. This requires changes
the existing users to not reuse the name of the symbol, but avoids
further differences between GCC 4.1 and GCC 4.2+/clang.

diffstat:

 crypto/external/bsd/libsaslc/dist/src/mech.c |  32 ++++++++++++++--------------
 lib/csu/alpha/crt0.c                         |   6 ++--
 lib/csu/arm_elf/crt0.c                       |   6 ++--
 lib/csu/common/crt0-common.c                 |  14 +++--------
 lib/csu/common_elf/common.h                  |   4 +-
 lib/csu/hppa/crt0.c                          |   6 ++--
 lib/csu/ia64/crt0.c                          |   6 ++--
 lib/csu/m68k_elf/crt0.c                      |   6 ++--
 lib/csu/mips/crt0.c                          |   6 ++--
 lib/csu/powerpc/crt0.c                       |  18 +++++++-------
 lib/csu/powerpc64/crt0.c                     |   6 ++--
 lib/csu/sh3_elf/crt0.c                       |   6 ++--
 lib/csu/sparc64/crt0.c                       |   6 ++--
 lib/csu/sparc_elf/crt0.c                     |   6 ++--
 lib/csu/vax_elf/crt0.c                       |   6 ++--
 lib/libc/net/nsdispatch.c                    |  11 +++------
 lib/libedit/vi.c                             |  20 ++++-------------
 sys/sys/cdefs_elf.h                          |  10 +++++++-
 18 files changed, 81 insertions(+), 94 deletions(-)

diffs (truncated from 590 to 300 lines):

diff -r e09939daef14 -r 65d6cb66cc00 crypto/external/bsd/libsaslc/dist/src/mech.c
--- a/crypto/external/bsd/libsaslc/dist/src/mech.c      Tue Feb 22 05:07:36 2011 +0000
+++ b/crypto/external/bsd/libsaslc/dist/src/mech.c      Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mech.c,v 1.6 2011/02/14 12:45:31 christos Exp $ */
+/* $NetBSD: mech.c,v 1.7 2011/02/22 05:45:05 joerg Exp $ */
 
 /* Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mech.c,v 1.6 2011/02/14 12:45:31 christos Exp $");
+__RCSID("$NetBSD: mech.c,v 1.7 2011/02/22 05:45:05 joerg Exp $");
 
 #include <sys/queue.h>
 
@@ -51,29 +51,29 @@
 #include "saslc_private.h"
 
 /* mechanisms */
-extern const saslc__mech_t saslc__mech_anonymous
+__weakref_visible const saslc__mech_t weak_saslc__mech_anonymous
     __weak_reference(saslc__mech_anonymous);
-extern const saslc__mech_t saslc__mech_crammd5
+__weakref_visible const saslc__mech_t weak_saslc__mech_crammd5
     __weak_reference(saslc__mech_crammd5);
-extern const saslc__mech_t saslc__mech_digestmd5
+__weakref_visible const saslc__mech_t weak_saslc__mech_digestmd5
     __weak_reference(saslc__mech_digestmd5);
-extern const saslc__mech_t saslc__mech_external
+__weakref_visible const saslc__mech_t weak_saslc__mech_external
     __weak_reference(saslc__mech_external);
-extern const saslc__mech_t saslc__mech_gssapi
+__weakref_visible const saslc__mech_t weak_saslc__mech_gssapi
     __weak_reference(saslc__mech_gssapi);
-extern const saslc__mech_t saslc__mech_login
+__weakref_visible const saslc__mech_t weak_saslc__mech_login
     __weak_reference(saslc__mech_login);
-extern const saslc__mech_t saslc__mech_plain
+__weakref_visible const saslc__mech_t weak_saslc__mech_plain
     __weak_reference(saslc__mech_plain);
 
 static const saslc__mech_t *saslc__mechanisms[] = {
-       &saslc__mech_anonymous,
-       &saslc__mech_crammd5,
-       &saslc__mech_digestmd5,
-       &saslc__mech_external,
-       &saslc__mech_gssapi,
-       &saslc__mech_login,
-       &saslc__mech_plain,
+       &weak_saslc__mech_anonymous,
+       &weak_saslc__mech_crammd5,
+       &weak_saslc__mech_digestmd5,
+       &weak_saslc__mech_external,
+       &weak_saslc__mech_gssapi,
+       &weak_saslc__mech_login,
+       &weak_saslc__mech_plain,
 };
 
 /*
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/alpha/crt0.c
--- a/lib/csu/alpha/crt0.c      Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/alpha/crt0.c      Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.24 2003/07/26 19:24:25 salo Exp $ */
+/* $NetBSD: crt0.c,v 1.25 2011/02/22 05:45:05 joerg Exp $ */
 
 /*
  * Copyright (c) 1995 Christopher G. Demetriou
@@ -65,7 +65,7 @@
                __ps_strings = ps_strings;
 
 #ifdef DYNAMIC
-       if (&_DYNAMIC != NULL)
+       if (&rtld_DYNAMIC != NULL)
                _rtld_setup(cleanup, obj);
 #endif
 
@@ -84,7 +84,7 @@
  * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.24 2003/07/26 19:24:25 salo Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.25 2011/02/22 05:45:05 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/arm_elf/crt0.c
--- a/lib/csu/arm_elf/crt0.c    Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/arm_elf/crt0.c    Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crt0.c,v 1.7 2008/06/21 00:52:52 gmcgarry Exp $        */
+/*     $NetBSD: crt0.c,v 1.8 2011/02/22 05:45:05 joerg Exp $   */
 
 /*
  * Copyright (C) 1997 Mark Brinicombe
@@ -68,7 +68,7 @@
 "      b       " ___STRING(_C_LABEL(___start)) " ");
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.7 2008/06/21 00:52:52 gmcgarry Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.8 2011/02/22 05:45:05 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 void
@@ -89,7 +89,7 @@
 
 #ifdef DYNAMIC
        /* ld(1) convention: if DYNAMIC = 0 then statically linked */
-       if (&_DYNAMIC)
+       if (&rtld_DYNAMIC)
                 _rtld_setup(cleanup, obj);
 #endif /* DYNAMIC */
 
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/common/crt0-common.c
--- a/lib/csu/common/crt0-common.c      Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/common/crt0-common.c      Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.3 2011/02/18 23:37:36 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.4 2011/02/22 05:45:06 joerg Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: crt0-common.c,v 1.3 2011/02/18 23:37:36 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.4 2011/02/22 05:45:06 joerg Exp $");
 
 #include <sys/types.h>
 #include <sys/syscall.h>
@@ -58,13 +58,7 @@
  * shared libs present, things will still work.
  */
 
-#if __GNUC_PREREQ__(4,2)
-static int rtld_DYNAMIC __attribute__((__weakref__, __alias__("_DYNAMIC")));
-#define        DYNAMIC_SYM     rtld_DYNAMIC
-#else
-extern int _DYNAMIC __weak_reference(_DYNAMIC);
-#define        DYNAMIC_SYM     _DYNAMIC
-#endif
+__weakref_visible int rtld_DYNAMIC __weak_reference(_DYNAMIC);
 
 #ifdef MCRT0
 extern void    monstartup(u_long, u_long);
@@ -111,7 +105,7 @@
        if (ps_strings != NULL)
                __ps_strings = ps_strings;
 
-       if (&DYNAMIC_SYM != NULL) {
+       if (&rtld_DYNAMIC != NULL) {
                if (obj == NULL)
                        _FATAL("NULL Obj_Entry pointer in GOT\n");
                if (obj->magic != RTLD_MAGIC)
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/common_elf/common.h
--- a/lib/csu/common_elf/common.h       Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/common_elf/common.h       Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.13 2009/12/14 01:04:02 matt Exp $ */
+/* $NetBSD: common.h,v 1.14 2011/02/22 05:45:06 joerg Exp $ */
 
 /*
  * Copyright (c) 1995 Christopher G. Demetriou
@@ -81,7 +81,7 @@
  * if we happen to be compiling without -static but with without any
  * shared libs present, things will still work.
  */
-extern int _DYNAMIC __weak_reference(_DYNAMIC);
+__weakref_visible int rtld_DYNAMIC __weak_reference(_DYNAMIC);
 #endif /* DYNAMIC */
 
 #ifdef MCRT0
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/hppa/crt0.c
--- a/lib/csu/hppa/crt0.c       Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/hppa/crt0.c       Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crt0.c,v 1.7 2004/08/26 21:07:14 thorpej Exp $ */
+/*     $NetBSD: crt0.c,v 1.8 2011/02/22 05:45:06 joerg Exp $   */
 
 /*
  * Copyright (c) 2002 Matt Fredette
@@ -110,7 +110,7 @@
         * For now, we take the easy way out and compare &_DYNAMIC 
         * to %dp, as well as to NULL.
         */
-       if (&_DYNAMIC != NULL && (int)&_DYNAMIC != dp)
+       if (&rtld_DYNAMIC != NULL && (int)&rtld_DYNAMIC != dp)
                _rtld_setup(cleanup, obj);
 #endif
 
@@ -152,7 +152,7 @@
  * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.7 2004/08/26 21:07:14 thorpej Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.8 2011/02/22 05:45:06 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/ia64/crt0.c
--- a/lib/csu/ia64/crt0.c       Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/ia64/crt0.c       Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.2 2006/09/15 05:29:44 skrll Exp $ */
+/* $NetBSD: crt0.c,v 1.3 2011/02/22 05:45:06 joerg Exp $ */
 
 /*
  * Copyright (c) 1995 Christopher G. Demetriou
@@ -72,7 +72,7 @@
                __ps_strings = ps_strings;
 
 #ifdef DYNAMIC
-       if (&_DYNAMIC != NULL)
+       if (&rtld_DYNAMIC != NULL)
                _rtld_setup(cleanup, obj);
 #endif
 
@@ -91,7 +91,7 @@
  * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.2 2006/09/15 05:29:44 skrll Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.3 2011/02/22 05:45:06 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/m68k_elf/crt0.c
--- a/lib/csu/m68k_elf/crt0.c   Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/m68k_elf/crt0.c   Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.11 2004/08/26 21:09:52 thorpej Exp $ */
+/* $NetBSD: crt0.c,v 1.12 2011/02/22 05:45:06 joerg Exp $ */
 
 /*
  * Copyright (c) 1999 Klaus Klein
@@ -75,7 +75,7 @@
                __ps_strings = ps_strings;
 
 #ifdef DYNAMIC
-       if (&_DYNAMIC != NULL)
+       if (&rtld_DYNAMIC != NULL)
                _rtld_setup(cleanup, obj);
 #endif
 
@@ -94,7 +94,7 @@
  * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.11 2004/08/26 21:09:52 thorpej Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.12 2011/02/22 05:45:06 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/mips/crt0.c
--- a/lib/csu/mips/crt0.c       Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/mips/crt0.c       Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.21 2011/01/23 06:25:57 matt Exp $ */
+/* $NetBSD: crt0.c,v 1.22 2011/02/22 05:45:07 joerg Exp $ */
 
 /*
  * Copyright (c) 1995 Christopher G. Demetriou
@@ -142,7 +142,7 @@
                 * XXX If we were loaded by that loader, just abort
                 * XXX the rtld setup.
                 */
-               if (&_DYNAMIC != NULL && cleanup != NULL && obj != NULL)
+               if (&rtld_DYNAMIC != NULL && cleanup != NULL && obj != NULL)
                        _rtld_setup(cleanup, obj);
 #endif
        }
@@ -163,7 +163,7 @@
  *  is the entrypoint. (Only needed for old toolchains).
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.21 2011/01/23 06:25:57 matt Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.22 2011/02/22 05:45:07 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"
diff -r e09939daef14 -r 65d6cb66cc00 lib/csu/powerpc/crt0.c
--- a/lib/csu/powerpc/crt0.c    Tue Feb 22 05:07:36 2011 +0000
+++ b/lib/csu/powerpc/crt0.c    Tue Feb 22 05:45:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.26 2006/05/18 17:54:19 christos Exp $ */
+/* $NetBSD: crt0.c,v 1.27 2011/02/22 05:45:07 joerg Exp $ */
 
 /*
  * Copyright (c) 1997 Jason R. Thorpe.
@@ -41,8 +41,8 @@
  * Small Data Area designators.  If not defined, will show up as being
  * at address zero.
  */
-extern int _SDA_BASE_[] __weak_reference(_SDA_BASE_);
-extern int _SDA2_BASE_[] __weak_reference(_SDA2_BASE_);
+__weakref_visible int rtld_SDA_BASE_[] __weak_reference(_SDA_BASE_);



Home | Main Index | Thread Index | Old Index