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.
This commit is contained in:
christos 2011-10-06 20:31:41 +00:00
parent 9924597a17
commit adc9c9a3d6
2 changed files with 7 additions and 5 deletions

View File

@ -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 @@ __RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $");
__weak_alias(getprogname,_getprogname)
#endif
extern const char *__progname;
const char *__progname;
const char *
getprogname(void)

View File

@ -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 @@ __warn_references(__findenv,
/* 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)