Subject: Re: Turning off optimization on selected files.
To: None <eeh@turbolinux.com>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 06/08/2000 14:36:21
>Our config seems to get upset about [the duplicate "file" definition] ...

Oops.  Guess I applied this *after* I went to BSDI. :-)

Hm, oops#2: this only allows you to override:

	file foo/bar.c

with a new:

	file substitute/bar.c

or:

	file machdep/bar.s	# assembly language version, for speed

(which *definitely* was in the design).  I am not sure now whether I
originally thought you should be able to override the "file foo/bar.c"
itself.  If this seems like a good idea, the new code here should
be applied in the other ("duplicate file") case.  The test should
then be on fi->srcfile, not fi->path (in both cases).

Chris

revision 2.2
date: 1995/03/24 20:44:09;  author: torek;  state: Exp;  lines: +20 -7
The file-override feature (via, e.g., `include "files.test"' in
a kernel configuration, where `files.test' contains some alternative
kernel source files that replace the standard ones) was incomplete.
Insert the code necessary to make it work as designed.
----------------------------
Index: files.c
===================================================================
RCS file: /master/usr.sbin/config/files.c,v
retrieving revision 2.1
retrieving revision 2.2
diff -c -2 -r2.1 -r2.2
*** files.c	1995/02/03 17:19:41	2.1
--- files.c	1995/03/24 20:44:09	2.2
***************
*** 1,3 ****
! /*	BSDI $Id: files.c,v 2.1 1995/02/03 17:19:41 polk Exp $	*/
  
  /* 
--- 1,3 ----
! /*	BSDI $Id: files.c,v 2.2 1995/03/24 20:44:09 torek Exp $	*/
  
  /* 
***************
*** 231,240 ****
  			if ((ofi = ht_lookup(basetab, fi->fi_base)) == NULL)
  				panic("fixfiles ht_lookup(%s)", fi->fi_base);
! 			xerror(fi->fi_srcfile, fi->fi_srcline,
! 			    "object file collision on %s.o, from %s",
! 			    fi->fi_base, fi->fi_path);
! 			xerror(ofi->fi_srcfile, ofi->fi_srcline,
! 			    "here is the previous file: %s", ofi->fi_path);
! 			err = 1;
  		}
  		fi->fi_flags |= FI_SEL;
--- 231,253 ----
  			if ((ofi = ht_lookup(basetab, fi->fi_base)) == NULL)
  				panic("fixfiles ht_lookup(%s)", fi->fi_base);
! 			/*
! 			 * If the new file comes from a different source,
! 			 * allow the new one to override the old one.
! 			 */
! 			if (fi->fi_path != ofi->fi_path) {
! 				if (ht_replace(basetab, fi->fi_base, fi) != 1)
! 					panic("fixfiles ht_replace(%s)",
! 					    fi->fi_base);
! 				ofi->fi_flags &= ~FI_SEL;
! 				ofi->fi_flags |= FI_HIDDEN;
! 			} else {
! 				xerror(fi->fi_srcfile, fi->fi_srcline,
! 				    "object file collision on %s.o, from %s",
! 				    fi->fi_base, fi->fi_path);
! 				xerror(ofi->fi_srcfile, ofi->fi_srcline,
! 				    "here is the previous file: %s",
! 				    ofi->fi_path);
! 				err = 1;
! 			}
  		}
  		fi->fi_flags |= FI_SEL;