This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Separate target and host config files


Hi,
this patch fixes the problem with runtime checking that Mike Stump uncovered.
The problem is that we did not have an auto-target.h equivalent of auto-host.h.
As such, including 'tconfig.h' did not get you any target side configuration
switches from configure, whereas 'config.h' would get you the host side
equivalents.  Some of the target files would explicitly include 'auto-host.h'
to get at some configuration #defines.  This is of course ugly and dangerous.

This patch fixes the problem by adding a new 'tconfig.in' template and
amending the configure machinery to create auto-target.h from that, and
inlude that file in 'tconfig.h'.  This allowed me to remove the #include
auto-host.h from the target side libraries.  I also uncovered a couple
of typos with the runtime checking configure processing.

booted and tested on i686-pc-linux-gnu, both with and without checking.
I manually confirmed that libgcov, which is the only runtime library
currently using runtime gcc_asserts, was built correctly in both cases.

ok?

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-05-04  Nathan Sidwell  <nathan@codesourcery.com>

	* Makefile.in (auto-target.h): New target.
	(cstamp-h): Depend on tconfig.in, stamp the file here.
	* configure.ac (AC_CONFIG_HEADERS): Add auto-target.h.
	(enable-checking): Fix typos with ac_runtime_checking.
	(xm_file): Prepend auto-target.h, fix case statement splitting it
	apart.
	(AC_CONFIG_COMMANDS): Do not touch cstamp-h here.
	* mkconfig.sh: Adjust comment about HEADERS containing auto-FOO
	file.
	* tconfig.in: New.
	* crtstuff.c: Do not include auto-host.h.
	(IN_LIBGCC2): Do not define.
	* gcov-io.h: Include tconfig.h, not auto-host.h.
	* libgcc2.c: Do not include auto-host.h.
	(abort): Do not undefine.
	* libgcov.c: Remove unneeded comment about config.h.
	* unwind-dw2-fde-glibc: Do not inlude auto-host.h.
	* configure: Rebuilt.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1476
diff -c -3 -p -r1.1476 Makefile.in
*** Makefile.in	23 Apr 2005 00:59:19 -0000	1.1476
--- Makefile.in	4 May 2005 11:29:17 -0000
*************** mklibgcc: $(srcdir)/mklibgcc.in
*** 1128,1138 ****
  @MAINT@	(cd $(srcdir) && autoheader)
  @MAINT@	@rm -f $(srcdir)/cstamp-h.in
  @MAINT@	echo timestamp > $(srcdir)/cstamp-h.in
! auto-host.h: cstamp-h ; @true
! cstamp-h: config.in config.status
! 	CONFIG_HEADERS=auto-host.h:config.in \
  	CONFIG_FILES= \
  	LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
  
  # Really, really stupid make features, such as SUN's KEEP_STATE, may force
  # a target to build even if it is up-to-date.  So we must verify that
--- 1128,1139 ----
  @MAINT@	(cd $(srcdir) && autoheader)
  @MAINT@	@rm -f $(srcdir)/cstamp-h.in
  @MAINT@	echo timestamp > $(srcdir)/cstamp-h.in
! auto-host.h auto-target.h: cstamp-h ; @true
! cstamp-h: config.in tconfig.in config.status
! 	CONFIG_HEADERS="auto-host.h:config.in auto-target.h:tconfig.in"\
  	CONFIG_FILES= \
  	LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
+ 	echo timestamp > $@
  
  # Really, really stupid make features, such as SUN's KEEP_STATE, may force
  # a target to build even if it is up-to-date.  So we must verify that
Index: configure
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure,v
retrieving revision 1.898
diff -c -3 -p -r1.898 configure
*** configure	27 Apr 2005 20:35:40 -0000	1.898
--- configure	4 May 2005 11:29:52 -0000
*************** ac_compiler_gnu=$ac_cv_c_compiler_gnu
*** 1381,1387 ****
  
  
  
!           ac_config_headers="$ac_config_headers auto-host.h:config.in"
  
  
  # Determine the host, build, and target systems
--- 1381,1387 ----
  
  
  
!                     ac_config_headers="$ac_config_headers auto-host.h:config.in auto-target.h:tconfig.in"
  
  
  # Determine the host, build, and target systems
*************** do
*** 6292,6303 ****
  	yes)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking= ; ac_gc_checking=1 ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking=1 ; ac_runtime_chacking=1 ;
  			ac_tree_checking=1 ; ac_valgrind_checking= ;;
  	no|none)	ac_assert_checking= ; ac_checking= ;
  			ac_fold_checking= ; ac_gc_checking= ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking= ; ac_runtime_chacking= ;
  			ac_tree_checking= ; ac_valgrind_checking= ;;
  	all)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking=1 ; ac_gc_checking=1 ;
--- 6292,6303 ----
  	yes)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking= ; ac_gc_checking=1 ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
  			ac_tree_checking=1 ; ac_valgrind_checking= ;;
  	no|none)	ac_assert_checking= ; ac_checking= ;
  			ac_fold_checking= ; ac_gc_checking= ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking= ; ac_runtime_checking= ;
  			ac_tree_checking= ; ac_valgrind_checking= ;;
  	all)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking=1 ; ac_gc_checking=1 ;
*************** host_xm_file="auto-host.h ansidecl.h ${h
*** 12236,12242 ****
  build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
  # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
  # put this back in temporarily.
! xm_file="ansidecl.h ${xm_file}"
  
  # --------
  # UNSORTED
--- 12236,12242 ----
  build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
  # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
  # put this back in temporarily.
! xm_file="auto-target.h ansidecl.h ${xm_file}"
  
  # --------
  # UNSORTED
*************** for f in $xm_file; do
*** 12586,12592 ****
         xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
         xm_include_list="${xm_include_list} $f"
         ;;
!     auto-host.h )
         xm_file_list="${xm_file_list} $f"
         xm_include_list="${xm_include_list} $f"
         ;;
--- 12586,12592 ----
         xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
         xm_include_list="${xm_include_list} $f"
         ;;
!     auto-target.h )
         xm_file_list="${xm_file_list} $f"
         xm_include_list="${xm_include_list} $f"
         ;;
*************** do
*** 15984,15989 ****
--- 15984,15990 ----
    "$all_outputs" ) CONFIG_FILES="$CONFIG_FILES $all_outputs" ;;
    "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
    "auto-host.h" ) CONFIG_HEADERS="$CONFIG_HEADERS auto-host.h:config.in" ;;
+   "auto-target.h" ) CONFIG_HEADERS="$CONFIG_HEADERS auto-target.h:tconfig.in" ;;
    *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
  echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
     { (exit 1); exit 1; }; };;
*************** esac
*** 16808,16817 ****
  echo "$as_me: executing $ac_dest commands" >&6;}
    case $ac_dest in
      default )
- case ${CONFIG_HEADERS} in
-   *auto-host.h:config.in*)
-   echo > cstamp-h ;;
- esac
  # Make sure all the subdirs exist.
  for d in $subdirs doc build
  do
--- 16809,16814 ----
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.ac,v
retrieving revision 2.106
diff -c -3 -p -r2.106 configure.ac
*** configure.ac	27 Apr 2005 20:35:38 -0000	2.106
--- configure.ac	4 May 2005 11:29:58 -0000
***************
*** 28,34 ****
  AC_PREREQ(2.59)
  AC_INIT
  AC_CONFIG_SRCDIR(tree.c)
! AC_CONFIG_HEADER(auto-host.h:config.in)
  
  # Determine the host, build, and target systems
  AC_CANONICAL_BUILD
--- 28,34 ----
  AC_PREREQ(2.59)
  AC_INIT
  AC_CONFIG_SRCDIR(tree.c)
! AC_CONFIG_HEADERS(auto-host.h:config.in auto-target.h:tconfig.in)
  
  # Determine the host, build, and target systems
  AC_CANONICAL_BUILD
*************** do
*** 421,432 ****
  	yes)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking= ; ac_gc_checking=1 ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking=1 ; ac_runtime_chacking=1 ;
  			ac_tree_checking=1 ; ac_valgrind_checking= ;;
  	no|none)	ac_assert_checking= ; ac_checking= ;
  			ac_fold_checking= ; ac_gc_checking= ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking= ; ac_runtime_chacking= ;
  			ac_tree_checking= ; ac_valgrind_checking= ;;
  	all)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking=1 ; ac_gc_checking=1 ;
--- 421,432 ----
  	yes)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking= ; ac_gc_checking=1 ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
  			ac_tree_checking=1 ; ac_valgrind_checking= ;;
  	no|none)	ac_assert_checking= ; ac_checking= ;
  			ac_fold_checking= ; ac_gc_checking= ;
  			ac_gc_always_collect= ; ac_rtl_checking= ;
! 			ac_rtlflag_checking= ; ac_runtime_checking= ;
  			ac_tree_checking= ; ac_valgrind_checking= ;;
  	all)		ac_assert_checking=1 ; ac_checking=1 ;
  			ac_fold_checking=1 ; ac_gc_checking=1 ;
*************** host_xm_file="auto-host.h ansidecl.h ${h
*** 1402,1408 ****
  build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
  # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
  # put this back in temporarily.
! xm_file="ansidecl.h ${xm_file}"
  
  # --------
  # UNSORTED
--- 1402,1408 ----
  build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
  # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
  # put this back in temporarily.
! xm_file="auto-target.h ansidecl.h ${xm_file}"
  
  # --------
  # UNSORTED
*************** for f in $xm_file; do
*** 1568,1574 ****
         xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
         xm_include_list="${xm_include_list} $f"
         ;;
!     auto-host.h )
         xm_file_list="${xm_file_list} $f"
         xm_include_list="${xm_include_list} $f"
         ;;
--- 1568,1574 ----
         xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
         xm_include_list="${xm_include_list} $f"
         ;;
!     auto-target.h )
         xm_file_list="${xm_file_list} $f"
         xm_include_list="${xm_include_list} $f"
         ;;
*************** AC_CONFIG_FILES($all_outputs)
*** 3393,3402 ****
  
  AC_CONFIG_COMMANDS([default],
  [
- case ${CONFIG_HEADERS} in
-   *auto-host.h:config.in*)
-   echo > cstamp-h ;;
- esac
  # Make sure all the subdirs exist.
  for d in $subdirs doc build
  do
--- 3393,3398 ----
Index: crtstuff.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/crtstuff.c,v
retrieving revision 1.71
diff -c -3 -p -r1.71 crtstuff.c
*** crtstuff.c	29 Apr 2005 14:09:36 -0000	1.71
--- crtstuff.c	4 May 2005 11:30:00 -0000
*************** Software Foundation, 59 Temple Place - S
*** 51,65 ****
  
     This file must be compiled with gcc.  */
  
- /* It is incorrect to include config.h here, because this file is being
-    compiled for the target, and hence definitions concerning only the host
-    do not apply.  */
- 
- #define IN_LIBGCC2
- 
- /* We include auto-host.h here to get HAVE_GAS_HIDDEN.  This is
-    supposedly valid even though this is a "target" file.  */
- #include "auto-host.h"
  #include "tconfig.h"
  #include "tsystem.h"
  #include "coretypes.h"
--- 51,56 ----
Index: gcov-io.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcov-io.h,v
retrieving revision 1.57
diff -c -3 -p -r1.57 gcov-io.h
*** gcov-io.h	2 May 2005 18:01:56 -0000	1.57
--- gcov-io.h	4 May 2005 11:30:02 -0000
*************** typedef HOST_WIDEST_INT gcov_type;
*** 232,238 ****
     is not also used in a DSO.  */
  #if IN_LIBGCOV
  
! #include "auto-host.h"   /* for HAVE_GAS_HIDDEN */
  
  #define gcov_var __gcov_var
  #define gcov_open __gcov_open
--- 232,238 ----
     is not also used in a DSO.  */
  #if IN_LIBGCOV
  
! #include "tconfig.h"
  
  #define gcov_var __gcov_var
  #define gcov_open __gcov_open
Index: libgcc2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/libgcc2.c,v
retrieving revision 1.189
diff -c -3 -p -r1.189 libgcc2.c
*** libgcc2.c	29 Apr 2005 14:09:38 -0000	1.189
--- libgcc2.c	4 May 2005 11:30:05 -0000
*************** along with GCC; see the file COPYING.  I
*** 29,52 ****
  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.  */
  
- 
- /* We include auto-host.h here to get HAVE_GAS_HIDDEN.  This is
-    supposedly valid even though this is a "target" file.  */
- #include "auto-host.h"
- 
- /* It is incorrect to include config.h here, because this file is being
-    compiled for the target, and hence definitions concerning only the host
-    do not apply.  */
  #include "tconfig.h"
  #include "tsystem.h"
  #include "coretypes.h"
  #include "tm.h"
  
- /* Don't use `fancy_abort' here even if config.h says to use it.  */
- #ifdef abort
- #undef abort
- #endif
- 
  #ifdef HAVE_GAS_HIDDEN
  #define ATTRIBUTE_HIDDEN  __attribute__ ((__visibility__ ("hidden")))
  #else
--- 29,39 ----
Index: libgcov.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/libgcov.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 libgcov.c
*** libgcov.c	28 Apr 2005 05:38:32 -0000	1.29
--- libgcov.c	4 May 2005 11:30:07 -0000
*************** along with GCC; see the file COPYING.  I
*** 29,38 ****
  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.  */
  
- /* It is incorrect to include config.h here, because this file is being
-    compiled for the target, and hence definitions concerning only the host
-    do not apply.  */
- 
  #include "tconfig.h"
  #include "tsystem.h"
  #include "coretypes.h"
--- 29,34 ----
Index: mkconfig.sh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/mkconfig.sh,v
retrieving revision 1.13
diff -c -3 -p -r1.13 mkconfig.sh
*** mkconfig.sh	21 Jun 2003 05:20:05 -0000	1.13
--- mkconfig.sh	4 May 2005 11:30:07 -0000
*************** for def in $DEFINES; do
*** 54,60 ****
      echo "#endif" >> ${output}T
  done
  
! # The first entry in HEADERS may be auto-host.h or auto-build.h;
  # it wants to be included even when not -DIN_GCC.
  if [ -n "$HEADERS" ]; then
      set $HEADERS
--- 54,60 ----
      echo "#endif" >> ${output}T
  done
  
! # The first entry in HEADERS may be auto-FOO.h ;
  # it wants to be included even when not -DIN_GCC.
  if [ -n "$HEADERS" ]; then
      set $HEADERS
Index: unwind-dw2-fde-glibc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2-fde-glibc.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 unwind-dw2-fde-glibc.c
*** unwind-dw2-fde-glibc.c	5 Mar 2005 14:01:02 -0000	1.17
--- unwind-dw2-fde-glibc.c	4 May 2005 11:30:13 -0000
***************
*** 33,39 ****
  #define _GNU_SOURCE 1
  #endif
  
- #include "auto-host.h" /* For HAVE_LD_EH_FRAME_HDR.  */
  #include "tconfig.h"
  #include "tsystem.h"
  #ifndef inhibit_libc
--- 33,38 ----
Index: tconfig.in
===================================================================
RCS file: tconfig.in
diff -N tconfig.in
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tconfig.in	4 May 2005 11:38:46 -0000
***************
*** 0 ****
--- 1,14 ----
+ /* tconfig.in, configuration for target.
+ 
+    Unlike config.in, this must be manually generated.  Contains the
+    configuration defines needed for runtime libraries.  */
+ 
+ /* Define if you want runtime assertions enabled. This is a cheap check. */
+ #undef ENABLE_RUNTIME_CHECKING
+ 
+ /* Define if your assembler and linker support .hidden. */
+ #undef HAVE_GAS_HIDDEN
+ 
+ /* Define if your linker supports --eh-frame-hdr option. */
+ #undef HAVE_LD_EH_FRAME_HDR
+ 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]