Subject: Re: ld.elf_so heads up.
To: Simon Burge <simonb@netbsd.org>
From: None <erh@nimenees.com>
List: current-users
Date: 04/15/2000 22:49:38
On Sun, Apr 16, 2000 at 01:21:18PM +1000, Simon Burge wrote:
> erh@nimenees.com wrote:
> > 	Also, the changes to crt0 were nearly identical across all elf ports,
> > but I only have i386 and alpha to test on.  If you have any of:
> > 	m68k, mips, powerpc, sh3, sparc, sparc64, vax
> > please check if it works correctly.  I have a couple test programs at
> > ftp://ftp.netbsd.org/pub/NetBSD/misc/erh/ld_crt0_test.tgz
> 
> This with the updated ld.elf_so on mips, but I don't see any recent
> changes to lib/csu??
	er.. yeah.  I haven't committed that part yet.  The issue is
whether doing something like environ=foo from a library init section
should be seen in the main program or if crt0 should put it back to
what the loader originally set it to point to.
(I also changed my mind on how crt0 should check if environ has been set)
	I think that it should not be reset it if it's been changed because
that can lead to unexpected behavior if, for instance:
	You have a program with a c++ library
	The library initialized some global static variable with a call
	    to a function. ("static char *foopath = get_foo_path()")
	That function does some initialization work the first time it's
	    called that doesn't run again later.
	Part of the once done code sets either environ or __progname.
	crt0 runs and trashes what the program already set up.

	However, at least one other OS (Linux, not the best example) does
overwrite it.  I haven't checked any others yet, such as Solaris.

eric