X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: Andris Pavenis To: djgpp-workers AT delorie DOT com Subject: Re: Fix for environ pollution Date: Thu, 28 Oct 2004 16:54:51 +0300 User-Agent: KMail/1.7.1 References: <10408121516 DOT AA22369 AT clio DOT rice DOT edu> <411C4D77 DOT A09F108B AT yahoo DOT com> <200408130519 DOT i7D5J9sU013440 AT envy DOT delorie DOT com> In-Reply-To: <200408130519.i7D5J9sU013440@envy.delorie.com> Cc: DJ Delorie MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410281654.51361.pavenis@latnet.lv> Reply-To: djgpp-workers AT delorie DOT com On Friday 13 August 2004 08:19, DJ Delorie wrote: > > The point is that 'environ' is not in static storage, it is only > > in the parameter list of main, under any name you like. Or not. > > I think you're missing the point that "environ" *is* defined to be a > global symbol in the runtime, not just a parameter to main(). It > happens to be passed to main (at which point it is effectively > nameless as far as the runtime is concerned), but for historic reasons > we must provide a global symbol "environ" as well, even without any > #includes. The only way to do this cleanly is with PROVIDE. It causes problems and will cause many complaints due to presence of GCC own djgpp-x.djl. As result _environ stays unresolved if linker script provided with GCC is being used, which is default for any recent ports of GCC. I think, that a better way is to use a separate source file in libc which contains definition of _environ only. Perhaps it would be best to revert the change of lib/djgpp.djl and put _environ in a separate fiel. Andris