Move fixed headers to include-fixed

Joseph S. Myers joseph@codesourcery.com
Tue Feb 27 00:10:00 GMT 2007


This patch makes the fixed headers go in libsubdir/include-fixed
instead of mixed with other headers in libsubdir/include.

This allows the mkheaders script to work properly.  Recall that
mkheaders and associated data files are installed with GCC so that if
the install tree is then transferred to a system with different system
headers fixincludes can be rerun there, and to help with distributing
GCC binaries for systems where the fixed headers can't be
redistributed.  mkheaders removes the fixed headers and then reruns
fixincludes.  However, it did this by removing all the contents of
libsubdir/include - including headers for various runtime libraries
which it did not then reinstall.  With the headers cleanly separated
it can just remove the contents of include-fixed instead.

I am not presently proposing to implement the addition of
include-freestanding and changes to search paths for -ffreestanding
suggested at <http://gcc.gnu.org/ml/gcc/2004-11/msg00254.html>, and
for simplicity of implementation limits.h goes in include-fixed in all
cases with this patch.

Bootstrapped and installed with no regressions on i686-pc-linux-gnu
and verified that mkheaders recreated the include-fixed directory
properly.  OK to commit?

fixincludes:
2007-02-26  Joseph Myers  <joseph@codesourcery.com>

	* mkheaders.in (incdir): Use include-fixed not include.

gcc:
2007-02-26  Joseph Myers  <joseph@codesourcery.com>

	* Makefile.in (PREPROCESSOR_DEFINES, test-protoize-simple): Define
	FIXED_INCLUDE_DIR.
	(stmp-int-hdrs, stmp-fixinc, install-headers): Use include-fixed
	for fixed headers and limits.h.
	(install-include-dir, install-headers-tar, install-headers-cpio,
	install-headers-cp, real-install-headers-tar,
	real-install-headers-cpio, real-install-headers-cp): Handle
	include-fixed as well as include.
	(install-mkheaders): Don't install files that go only in include
	not include-fixed.
	* cppdefault.c (cpp_include_defaults): Separate FIXED_INCLUDE_DIR
	from GCC_INCLUDE_DIR.
	* gcc.c (process_command): Remove special -BstageN/ handling.
	(do_spec_1): Add include-fixed directories.

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 122331)
+++ gcc/gcc.c	(working copy)
@@ -3816,28 +3816,6 @@
 		    value = tmp;
 		  }
 
-		/* As a kludge, if the arg is "[foo/]stageN/", just
-		   add "[foo/]include" to the include prefix.  */
-		if ((len == 7
-		     || (len > 7
-			 && (IS_DIR_SEPARATOR (value[len - 8]))))
-		    && strncmp (value + len - 7, "stage", 5) == 0
-		    && ISDIGIT (value[len - 2])
-		    && (IS_DIR_SEPARATOR (value[len - 1])))
-		  {
-		    if (len == 7)
-		      add_prefix (&include_prefixes, "./", NULL,
-				  PREFIX_PRIORITY_B_OPT, 0, 0);
-		    else
-		      {
-		        char *string = xmalloc (len - 6);
-			memcpy (string, value, len - 7);
-			string[len - 7] = 0;
-		        add_prefix (&include_prefixes, string, NULL,
-				    PREFIX_PRIORITY_B_OPT, 0, 0);
-		      }
-		  }
-
 		add_prefix (&exec_prefixes, value, NULL,
 			    PREFIX_PRIORITY_B_OPT, 0, 0);
 		add_prefix (&startfile_prefixes, value, NULL,
@@ -4998,6 +4976,11 @@
 
 	      for_each_path (&include_prefixes, false, info.append_len,
 			     spec_path, &info);
+
+	      info.append = "include-fixed";
+	      info.append_len = strlen (info.append);
+	      for_each_path (&include_prefixes, false, info.append_len,
+			     spec_path, &info);
 	    }
 	    break;
 
Index: gcc/cppdefault.c
===================================================================
--- gcc/cppdefault.c	(revision 122331)
+++ gcc/cppdefault.c	(working copy)
@@ -66,9 +66,13 @@
     { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
 #endif
 #ifdef GCC_INCLUDE_DIR
-    /* This is the dir for fixincludes and for gcc's private headers.  */
+    /* This is the dir for gcc's private headers.  */
     { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
 #endif
+#ifdef FIXED_INCLUDE_DIR
+    /* This is the dir for fixincludes.  */
+    { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
+#endif
 #ifdef CROSS_INCLUDE_DIR
     /* One place the target system's headers might be.  */
     { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 122331)
+++ gcc/Makefile.in	(working copy)
@@ -3207,6 +3207,7 @@
 
 PREPROCESSOR_DEFINES = \
   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+  -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
   -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
   -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
@@ -3269,6 +3270,7 @@
 	./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
 	  $(GCC_CFLAGS) $(INCLUDES) \
 	  -DGCC_INCLUDE_DIR=0 \
+	  -DFIXED_INCLUDE_DIR=0 \
 	  -DGPLUSPLUS_INCLUDE_DIR=0 \
 	  -DCROSS_INCLUDE_DIR=0 \
 	  -DTOOL_INCLUDE_DIR=0 \
@@ -3281,6 +3283,7 @@
 	./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
 	  $(GCC_CFLAGS) $(INCLUDES) \
 	  -DGCC_INCLUDE_DIR=0 \
+	  -DFIXED_INCLUDE_DIR=0 \
 	  -DGPLUSPLUS_INCLUDE_DIR=0 \
 	  -DCROSS_INCLUDE_DIR=0 \
 	  -DTOOL_INCLUDE_DIR=0 \
@@ -3317,11 +3320,11 @@
 gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) $(LIBS) -o $@
 #
-# Build the include directory.  The stamp files are stmp-* rather than
+# Build the include directories.  The stamp files are stmp-* rather than
 # s-* so that mostlyclean does not force the include directory to
 # be rebuilt.
 
-# Build the include directory
+# Build the include directories.
 stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h $(UNWIND_H)
 # Copy in the headers provided with gcc.
 # The sed command gets just the last file name component;
@@ -3329,6 +3332,7 @@
 # Using basename would be simpler, but some systems don't have it.
 # The touch command is here to workaround an AIX/Linux NFS bug.
 	-if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi
+	-if [ -d include-fixed ] ; then true; else mkdir include-fixed; chmod a+rx include-fixed; fi
 	for file in .. $(USER_H); do \
 	  if [ X$$file != X.. ]; then \
 	    realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
@@ -3338,15 +3342,15 @@
 	    chmod a+r include/$$realfile; \
 	  fi; \
 	done
-	rm -f include/limits.h
-	cp xlimits.h include/limits.h
+	rm -f include-fixed/limits.h
+	cp xlimits.h include-fixed/limits.h
+	chmod a+r include-fixed/limits.h
 	rm -f include/unwind.h
 	cp $(UNWIND_H) include/unwind.h
-	chmod a+r include/limits.h
 # Install the README
-	rm -f include/README
-	cp $(srcdir)/../fixincludes/README-fixinc include/README
-	chmod a+r include/README
+	rm -f include-fixed/README
+	cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README
+	chmod a+r include-fixed/README
 	$(STAMP) $@
 
 .PHONY: install-gcc-tooldir
@@ -3389,8 +3393,8 @@
 	  if test "x${SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
 	  then sleep 1; else exit 1; fi; \
 	fi
-	rm -rf include; mkdir include
-	-chmod a+rx include
+	rm -rf include-fixed; mkdir include-fixed
+	-chmod a+rx include-fixed
 	if [ -d ../prev-gcc ]; then \
 	  cd ../prev-gcc && \
 	  $(MAKE) real-$(INSTALL_HEADERS_DIR) DESTDIR=`pwd`/../gcc/ \
@@ -3400,16 +3404,16 @@
 	    SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
 	    export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
 	    cd $(build_objdir)/fixincludes && \
-	    $(SHELL) ./fixinc.sh ../../gcc/include \
+	    $(SHELL) ./fixinc.sh ../../gcc/include-fixed \
 	      $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
-	  rm -f include/syslimits.h; \
-	  if [ -f include/limits.h ]; then \
-	    mv include/limits.h include/syslimits.h; \
+	  rm -f include-fixed/syslimits.h; \
+	  if [ -f include-fixed/limits.h ]; then \
+	    mv include-fixed/limits.h include-fixed/syslimits.h; \
 	  else \
-	    cp $(srcdir)/gsyslimits.h include/syslimits.h; \
+	    cp $(srcdir)/gsyslimits.h include-fixed/syslimits.h; \
 	  fi; \
 	fi
-	chmod a+r include/syslimits.h
+	chmod a+r include-fixed/syslimits.h
 	$(STAMP) stmp-fixinc
 
 # Files related to the fixproto script.
@@ -3943,14 +3947,14 @@
 # Fix symlinks to absolute paths in the installed include directory to
 # point to the installed directory, not the build directory.
 # Don't need to use LN_S here since we really do need ln -s and no substitutes.
-	-files=`cd $(DESTDIR)$(libsubdir)/include; find . -type l -print 2>/dev/null`; \
+	-files=`cd $(DESTDIR)$(libsubdir)/include-fixed; find . -type l -print 2>/dev/null`; \
 	if [ $$? -eq 0 ]; then \
-	  dir=`cd include; ${PWD_COMMAND}`; \
+	  dir=`cd include-fixed; ${PWD_COMMAND}`; \
 	  for i in $$files; do \
-	    dest=`ls -ld $(DESTDIR)$(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
+	    dest=`ls -ld $(DESTDIR)$(libsubdir)/include-fixed/$$i | sed -n 's/.*-> //p'`; \
 	    if expr "$$dest" : "$$dir.*" > /dev/null; then \
-	      rm -f $(DESTDIR)$(libsubdir)/include/$$i; \
-	      ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(DESTDIR)$(libsubdir)/include/$$i; \
+	      rm -f $(DESTDIR)$(libsubdir)/include-fixed/$$i; \
+	      ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(DESTDIR)$(libsubdir)/include-fixed/$$i; \
 	    fi; \
 	  done; \
 	fi
@@ -3958,8 +3962,11 @@
 # Create or recreate the gcc private include file directory.
 install-include-dir: installdirs
 	-rm -rf $(DESTDIR)$(libsubdir)/include
+	-rm -rf $(DESTDIR)$(libsubdir)/include-fixed
 	mkdir $(DESTDIR)$(libsubdir)/include
+	mkdir $(DESTDIR)$(libsubdir)/include-fixed
 	-chmod a+rx $(DESTDIR)$(libsubdir)/include
+	-chmod a+rx $(DESTDIR)$(libsubdir)/include-fixed
 
 # Create or recreate the install-tools include file directory.
 itoolsdir = $(libexecsubdir)/install-tools
@@ -3976,6 +3983,8 @@
 # output of `cd', but some shells lose on redirection within `()'s
 	(cd `${PWD_COMMAND}`/include ; \
 	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include; tar xpf - )
+	(cd `${PWD_COMMAND}`/include-fixed ; \
+	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
 # /bin/sh on some systems returns the status of the first tar,
 # and that can lose with GNU tar which always writes a full block.
 # So use `exit 0' to ignore its exit status.
@@ -3985,33 +3994,35 @@
 # See discussion about the use of `pwd` above
 	cd `${PWD_COMMAND}`/include ; \
 	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include
+	cd `${PWD_COMMAND}`/include-fixed ; \
+	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include-fixed
 
 # Install the include directory using cp.
 install-headers-cp: stmp-int-hdrs $(STMP_FIXPROTO) install-include-dir
 	cp -p -r include $(DESTDIR)$(libsubdir)
+	cp -p -r include-fixed $(DESTDIR)$(libsubdir)
 
 # Targets without dependencies, for use in prev-gcc during bootstrap.
 real-install-headers-tar:
 	(cd `${PWD_COMMAND}`/include ; \
 	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include; tar xpf - )
+	(cd `${PWD_COMMAND}`/include-fixed ; \
+	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
 
 real-install-headers-cpio:
 	cd `${PWD_COMMAND}`/include ; \
 	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include
+	cd `${PWD_COMMAND}`/include-fixed ; \
+	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include-fixed
 
 real-install-headers-cp:
 	cp -p -r include $(DESTDIR)$(libsubdir)
+	cp -p -r include-fixed $(DESTDIR)$(libsubdir)
 
 # Install supporting files for fixincludes to be run later.
 install-mkheaders: stmp-int-hdrs $(STMP_FIXPROTO) install-itoolsdirs \
   macro_list xlimits.h
-	for file in $(USER_H); do \
-	  realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
-	  $(INSTALL_DATA) $$file \
-	    $(DESTDIR)$(itoolsdatadir)/include/$$realfile ; \
-	done
 	$(INSTALL_DATA) xlimits.h $(DESTDIR)$(itoolsdatadir)/include/limits.h
-	$(INSTALL_DATA) $(UNWIND_H) $(DESTDIR)$(itoolsdatadir)/include/unwind.h
 	$(INSTALL_DATA) $(srcdir)/gsyslimits.h \
 	  $(DESTDIR)$(itoolsdatadir)/gsyslimits.h
 	$(INSTALL_DATA) macro_list $(DESTDIR)$(itoolsdatadir)/macro_list
Index: fixincludes/mkheaders.in
===================================================================
--- fixincludes/mkheaders.in	(revision 122331)
+++ fixincludes/mkheaders.in	(working copy)
@@ -77,7 +77,7 @@
 
 itoolsdir=${libexecsubdir}/install-tools
 itoolsdatadir=${libsubdir}/install-tools
-incdir=${libsubdir}/include
+incdir=${libsubdir}/include-fixed
 
 . ${itoolsdatadir}/mkheaders.conf
 

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list