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

Re: [MiNT] gcc 4.2.2 compile error



Hi,

On Monday 07 January 2008, MiKRO wrote:
> > [1] They rewrote how gcc parses/optimizes the code to be able to
> >      improve it, so I'm not surprised it's at first slower in doing
> >      compilations.
>
> well, the problem isn't slower compilation but the _crashing_
> compilation. the build process is unbelievable ineffective -- I have
> to watch 'make' to spot a crash, change -O2 to -O1 or -O0, then
> compile that file again and run 'make' from toplevel again... and to
> pray next file will be OK.
>
> I've even tried to compile it at aranym, 1 GB of memory is still for
> some sources too few !!! (with -O2). This isn't slower compilation,
> this is bug as hell. I'm really curious when they managed to fix it.

Is this something that is reported to GCC bugzilla, just because
it tries to use more memory than is available, or something
specific to the Atari port of the GCC?


> The next question is how to automate this thing -- let's say I'll made
> the list of "problem" files which needs -O1, would it be hard to make
> some patch which will replace -O2 in stage2 for these files?

Assuming your makefiles knows how to build things and respect environment
variables like all properly done makefiles do, something like following
could work:
--------------------------------------------
#!/bin/sh
topdir=$PWD
for i in $(find -name '*.c'); do
	subdir=${i%/*}
	basename=${i##*/}
	object=${basename%.c}.o
	cd $topdir/$subdir
	make CFLAGS=-O2 $object
	if [ $? -eq 0 ]; then continue; fi
	make CFLAGS=-O1 $object
	if [ $? -eq 0 ]; then continue; fi
	make CFLAGS=-O0 $object
done
--------------------------------------------

If you don't care about performance of the resulting code and just want it
to build things faster, start with -O1 (-O0 is too awful to be even
considered as a default option).


	- Eero