Source-Changes-HG archive

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

[src/trunk]: src/lib/libc Provide symbol definitions for environ and __progna...



details:   https://anonhg.NetBSD.org/src/rev/78ca87be33b2
branches:  trunk
changeset: 770166:78ca87be33b2
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 06 20:31:41 2011 +0000

description:
Provide symbol definitions for environ and __progname. These are duplicate
definitions to the ones provided by csu, but harmless since the linker resolves
them. There are 3 non weak data symbols provided in crt0.o:

    D __progname [initialized data, assigned to ""]
    B __ps_strings [BSS since assigned to 0]
    C environ [common, uninitialized]

__ps_strings had already a second definition in libc (in BSS), now we added
__progname and __ps_strings (in BSS).

To get rid of the duplicate definition, we can remove them from csu, and
move the assignments to libc.

This is done so that libc has no undefined symbols so that linker maps
that want to do:
    ...
        local:
                *;
    ...
don't end up producing link failures for libc.

diffstat:

 lib/libc/gen/getprogname.c |  6 +++---
 lib/libc/stdlib/_env.c     |  6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r ff887edafbfc -r 78ca87be33b2 lib/libc/gen/getprogname.c
--- a/lib/libc/gen/getprogname.c        Thu Oct 06 16:03:48 2011 +0000
+++ b/lib/libc/gen/getprogname.c        Thu Oct 06 20:31:41 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $ */
+/* $NetBSD: getprogname.c,v 1.4 2011/10/06 20:31:41 christos Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher G. Demetriou
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $");
+__RCSID("$NetBSD: getprogname.c,v 1.4 2011/10/06 20:31:41 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -47,7 +47,7 @@
 __weak_alias(getprogname,_getprogname)
 #endif
 
-extern const char *__progname;
+const char *__progname;
 
 const char *
 getprogname(void)
diff -r ff887edafbfc -r 78ca87be33b2 lib/libc/stdlib/_env.c
--- a/lib/libc/stdlib/_env.c    Thu Oct 06 16:03:48 2011 +0000
+++ b/lib/libc/stdlib/_env.c    Thu Oct 06 20:31:41 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _env.c,v 1.5 2010/11/17 13:25:53 tron Exp $ */
+/*     $NetBSD: _env.c,v 1.6 2011/10/06 20:31:41 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _env.c,v 1.5 2010/11/17 13:25:53 tron Exp $");
+__RCSID("$NetBSD: _env.c,v 1.6 2011/10/06 20:31:41 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -95,6 +95,8 @@
 /* Our initialization function. */
 void __libc_env_init(void);
 
+char **environ;
+
 /*ARGSUSED*/
 static signed int
 env_tree_compare_nodes(void *ctx, const void *node_a, const void *node_b)



Home | Main Index | Thread Index | Old Index