Subject: Re: Changes to crunchgen
To: jchacon <jchacon@dragon.sys.gtei.net>
From: James Chacon <jchacon@genuity.net>
List: tech-toolchain
Date: 10/04/2001 00:19:13
One minor nit folks will want to adjust in various ramdisk Makefiles.

You need to run the ramdiskbin.mk's clean rule before deleting it. Otherwise
it will leave output around potentially.

I've fixed x86 makefiles so far with:

if [ -f ${CBIN}.mk ]; then ${MAKE} -f ${CBIN}.mk clean; fi; \

in the beginning of the clean rule.

(you could pontentially fix this otherwise by just adding */*.o to the rm
line but that just feels dangerous)

James

>
>With the recent toolchain changes (USE_NEW_TOOLCHAIN) and some recent changes
>to crunchgen a major deficiency crops up in how crunchgen works today.
>
>It attempts to use the current object files (if they exist) to build the
>crunched image. Well, this is bad since most of those were built with
>optimizing cflags (i.e -O2) instead of something which tries to produce the
>smallest code possible (-Os or equiv).
>
>Them temporary work around to this was to cause each crunched object to nuke
>it's already existing objects and rebuild them all with DBG=-Os.
>
>This also is suboptimal since the crunchgen version of say /bin/cat shouldn't
>be modifying the build results from the normal src/bin/cat in it's src/objdirs.
>This results quite possibly causing a rebuild later on of the regular binary
>to end up with a mix of .o's with various optimizations set.
>
>So, what I'm about to check in are mods to crunchgen which do the following:
>
>Add a -d option to set the DBG flag to whatever flags the builder wants. If
>it's not set, default to -Os (so it's not hard coded into the binary.)
>
>Generate a makefile by default that does all object file builds in local
>subdirs by binary (i.e. bad144 gets built in $OBJDIR/bad144) via a reach over
>make. (Sets .PATH and .CURDIR and does a make for the objects needed in that
>dir).
>
>Add a -o option that does the old behavior of searching for obj files by
>querying the various object environment vars and searching. Without this
>option none of the objdir special options, environment vars, etc will have
>effect.
>
>In both cases the special options objpaths, objs, etc still work as they always
>have.
>
>I've tested this for all the x86 ramdisks and it all builds fine (installboot
>has some issues but thats local to it's Makefile I'll fix also).
>
>If folks have concerns, changes, etc they'd like to see with this please let
>me know. This shouldn't affect most ports snapshot builds unless it's 
>building a program that doesn't have a makefile which behaves to
>
>make <object file list>
>
>(only 1 so far I've found had this issue).
>
>I've also noticed most builds are building libhack with -O2 but everything
>else with -Os so that should be adjusted in those ramdisk builds as well.
>
>
>James
>
>(BTW: crunchgen should probably go into tools since it's not likely to be
>native on foreign systems or in the case of changes such as this work with
>a build in all cases).
>
>