Subject: re: building with gcc4
To: None <tech-toolchain@netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: tech-toolchain
Date: 05/13/2006 05:35:57
   
   
   unfortunately src/lib/csu is broken with GCC4 some how.  i had
   a quick look but it wasn't obvious what is going wrong.  it seems
   to be some problem with how our init_fallthru() works - dynamic
   programs dump core with a stack trace that repeats through
   this function and static binaries complain because _DYNAMIC is
   not NULL...  the same thing occurs on sparc64 & i386.  using
   older versions of crt0.o and crti.0 make things work again.
   
   it would be great if someone else looked at this while i'm
   looking at some other problems.


OK, christos and i looked at this a bit and i have found out a couple
things of note:

	- the problem occurs because init_fallthru() gets placed
	_before_ _init() in the asm fed to gas, so when it tries
	to "fallthru" to the init sections, it actually recurses
	through _init() over and over.  (guess my stack trace was
	actually valid...)

	- the "-fno-unit-at-a-time" makes the problem go away..
	seemingly even at -O0.  (i'm still doing some testing and
	i may have confused myself.)