diff mbox

Put libgcc config headers in separate libgcc_tm.h

Message ID Pine.LNX.4.64.1105072006420.24964@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers May 7, 2011, 8:09 p.m. UTC
This patch creates a separate libgcc_tm_file config.gcc variable and
associated generated header libgcc_tm.h to avoid listing files in
../../libgcc/config/ in tm_file and so that macros moved to libgcc
headers can be poisoned on the host because those headers are no
longer included on the host.

The aim is that eventually files built for the target should include
libgcc_tm.h directly, and not tm.h at all, but that requires
completing the transition away from use of host tm.h macros in libgcc.
Until that is done, the constraint is still present that the files in
libgcc/config/ cannot have the same names as those in gcc/config/ (see
PR 46040), but poisoning the macros for the host reduces the risk of
incompletely moving a macro or a new target being added that defines a
macro in the wrong place.  (It doesn't prevent partial conversions
like that for arm-symbianelf fixed by this patch, where the main
target macro was moved but a macro used within the ARM port definition
of DECLARE_LIBRARY_RENAMES had a different definition in a subtarget's
header and that subtarget definition wasn't moved.)

This patch should facilitate moving about 30 target macros used only
in code built for the target into libgcc headers.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu, and
tested with no regressions with cross to arm-none-eabi.  OK to commit?

gcc:
2011-05-07  Joseph Myers  <joseph@codesourcery.com>

	* config.gcc (libgcc_tm_file): Define instead of including files
	from ../../libgcc/config/ in tm_file.
	* configure.ac (libgcc_tm_file_list, libgcc_tm_include_list):
	Define.
	* configure: Regenerate.
	* Makefile.in (libgcc_tm_file_list, libgcc_tm_include_list,
	libgcc_tm.h, cs-libgcc_tm.h): New.
	(TM_H): Include libgcc_tm.h and $(libgcc_tm_file_list).
	(clean): Remove libgcc_tm.h.
	* config/arm/symbian.h (RENAME_LIBRARY): Remove.
	* mkconfig.sh: Include libgcc_tm.h in tm.h if USED_FOR_TARGET.
	* system.h (DECLARE_LIBRARY_RENAMES): Poison.

libgcc:
2011-05-07  Joseph Myers  <joseph@codesourcery.com>

	* config/arm/symbian-lib.h: New.

Comments

Ian Lance Taylor May 10, 2011, 1:21 p.m. UTC | #1
"Joseph S. Myers" <joseph@codesourcery.com> writes:

> 2011-05-07  Joseph Myers  <joseph@codesourcery.com>
>
> 	* config.gcc (libgcc_tm_file): Define instead of including files
> 	from ../../libgcc/config/ in tm_file.
> 	* configure.ac (libgcc_tm_file_list, libgcc_tm_include_list):
> 	Define.
> 	* configure: Regenerate.
> 	* Makefile.in (libgcc_tm_file_list, libgcc_tm_include_list,
> 	libgcc_tm.h, cs-libgcc_tm.h): New.
> 	(TM_H): Include libgcc_tm.h and $(libgcc_tm_file_list).
> 	(clean): Remove libgcc_tm.h.
> 	* config/arm/symbian.h (RENAME_LIBRARY): Remove.
> 	* mkconfig.sh: Include libgcc_tm.h in tm.h if USED_FOR_TARGET.
> 	* system.h (DECLARE_LIBRARY_RENAMES): Poison.
>
> libgcc:
> 2011-05-07  Joseph Myers  <joseph@codesourcery.com>
>
> 	* config/arm/symbian-lib.h: New.

This is OK.

Thanks.

Ian
diff mbox

Patch

Index: libgcc/config/arm/symbian-lib.h
===================================================================
--- libgcc/config/arm/symbian-lib.h	(revision 0)
+++ libgcc/config/arm/symbian-lib.h	(revision 0)
@@ -0,0 +1,28 @@ 
+/* Configuration file for Symbian OS on ARM processors, library renames.
+   Copyright (C) 2004, 2011 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* SymbianOS provides the BPABI routines in a separate library.
+   Therefore, we do not need to define any of them in libgcc.  */
+#undef RENAME_LIBRARY
+#define RENAME_LIBRARY(GCC_NAME, AEABI_NAME) /* empty */
Index: gcc/mkconfig.sh
===================================================================
--- gcc/mkconfig.sh	(revision 173509)
+++ gcc/mkconfig.sh	(working copy)
@@ -1,6 +1,7 @@ 
 #! /bin/sh
 
-# Copyright (C) 2001, 2002, 2006, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2006, 2007, 2010, 2011
+# Free Software Foundation, Inc.
 # This file is part of GCC.
 
 # GCC is free software; you can redistribute it and/or modify
@@ -19,7 +20,7 @@ 
 
 
 # Generate gcc's various configuration headers:
-# config.h, tconfig.h, bconfig.h, tm.h, and tm_p.h.
+# config.h, tconfig.h, bconfig.h, tm.h, libgcc_tm.h, and tm_p.h.
 # $1 is the file to generate.  DEFINES, HEADERS, and possibly
 # TARGET_CPU_DEFAULT are expected to be set in the environment.
 
@@ -88,8 +89,9 @@ 
 fi
 
 # If this is tm.h, now include insn-flags.h only if IN_GCC is defined
-# but neither GENERATOR_FILE nor USED_FOR_TARGET is defined.  (Much of
-# this is temporary.)
+# but neither GENERATOR_FILE nor USED_FOR_TARGET is defined.  Also
+# include libgcc_tm.h if USED_FOR_TARGET is defined.  (Much of this is
+# temporary.)
 
 case $output in
     tm.h )
@@ -97,6 +99,9 @@ 
 #if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET
 # include "insn-flags.h"
 #endif
+#ifdef USED_FOR_TARGET
+# include "libgcc_tm.h"
+#endif
 EOF
     ;;
 esac
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 173509)
+++ gcc/configure	(working copy)
@@ -618,6 +618,8 @@ 
 xm_file_list
 tm_p_include_list
 tm_p_file_list
+libgcc_tm_include_list
+libgcc_tm_file_list
 tm_defines
 tm_include_list
 tm_file_list
@@ -11233,6 +11235,13 @@ 
   esac
 done
 
+libgcc_tm_file_list=
+libgcc_tm_include_list=
+for f in $libgcc_tm_file; do
+  libgcc_tm_file_list="${libgcc_tm_file_list} \$(srcdir)/../libgcc/config/$f"
+  libgcc_tm_include_list="${libgcc_tm_include_list} ../libgcc/config/$f"
+done
+
 tm_p_file_list=
 tm_p_include_list=
 for f in $tm_p_file; do
@@ -17505,7 +17514,7 @@ 
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17508 "configure"
+#line 17517 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17611,7 +17620,7 @@ 
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17614 "configure"
+#line 17623 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -26223,6 +26232,8 @@ 
 
 
 
+
+
 # Echo link setup.
 if test x${build} = x${host} ; then
   if test x${host} = x${target} ; then
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 173509)
+++ gcc/configure.ac	(working copy)
@@ -1638,6 +1638,13 @@ 
   esac
 done
 
+libgcc_tm_file_list=
+libgcc_tm_include_list=
+for f in $libgcc_tm_file; do
+  libgcc_tm_file_list="${libgcc_tm_file_list} \$(srcdir)/../libgcc/config/$f"
+  libgcc_tm_include_list="${libgcc_tm_include_list} ../libgcc/config/$f"
+done
+
 tm_p_file_list=
 tm_p_include_list=
 for f in $tm_p_file; do
@@ -4773,6 +4780,8 @@ 
 AC_SUBST(tm_file_list)
 AC_SUBST(tm_include_list)
 AC_SUBST(tm_defines)
+AC_SUBST(libgcc_tm_file_list)
+AC_SUBST(libgcc_tm_include_list)
 AC_SUBST(tm_p_file_list)
 AC_SUBST(tm_p_include_list)
 AC_SUBST(xm_file_list)
Index: gcc/system.h
===================================================================
--- gcc/system.h	(revision 173509)
+++ gcc/system.h	(working copy)
@@ -761,6 +761,10 @@ 
 	CAN_DEBUG_WITHOUT_FP UNLIKELY_EXECUTED_TEXT_SECTION_NAME	\
 	HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P
 
+/* Target macros only used for code built for the target, that have
+   moved to libgcc-tm.h.  */
+ #pragma GCC poison DECLARE_LIBRARY_RENAMES
+
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
    been used.  */
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 173509)
+++ gcc/config.gcc	(working copy)
@@ -84,6 +84,12 @@ 
 #			build-directory files by prefixing them with "./".
 #			All other files should relative to $srcdir/config.
 #
+#  libgcc_tm_file	A list of target macro files used only for code
+#			built for the target, not the host.  These files
+#			are relative to $srcdir/../libgcc/config and
+#			must not have the same names as files in
+#			$srcdir/config.
+#
 #  tm_p_file		Location of file with declarations for functions
 #			in $out_file.
 #
@@ -206,6 +212,7 @@ 
 target_has_targetcm=no
 tm_defines=
 xm_defines=
+libgcc_tm_file=
 # Set this to force installation and use of collect2.
 use_collect2=
 # Set this to override the default target model.
@@ -794,7 +801,7 @@ 
 	case ${target} in
 	arm*-*-linux-*eabi)
 	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
-	    tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h"
+	    libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
 	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
 	    # Define multilib configuration for arm-linux-androideabi.
 	    case ${target} in
@@ -822,7 +829,7 @@ 
 	case ${target} in
 	arm*-*-uclinux*eabi)
 	    tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h"
-	    tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h"
+	    libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
 	    tmake_file="$tmake_file arm/t-bpabi"
   	    # The BPABI long long divmod functions return a 128-bit value in
 	    # registers r0-r3.  Correctly modeling that requires the use of
@@ -846,7 +853,7 @@ 
 	need_64bit_hwint=yes
 	default_use_cxa_atexit=yes
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
-	tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h"
+	libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
 	tmake_file="arm/t-arm arm/t-arm-elf"
 	case ${target} in
 	arm*-*-eabi*)
@@ -856,6 +863,7 @@ 
 	  ;;
 	arm*-*-symbianelf*)
 	  tm_file="${tm_file} arm/symbian.h"
+	  libgcc_tm_file="$libgcc_tm_file arm/symbian-lib.h"
 	  # We do not include t-bpabi for Symbian OS because the system
 	  # provides its own implementation of the BPABI functions.
 	  tmake_file="${tmake_file} arm/t-symbian"
@@ -954,13 +962,13 @@ 
 	;;
 frv-*-elf)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
-	tm_file="${tm_file} ../../libgcc/config/frv/frv-abi.h"
+	libgcc_tm_file="${libgcc_tm_file} frv/frv-abi.h"
 	tmake_file=frv/t-frv
 	;;
 frv-*-*linux*)
 	tm_file="dbxelf.h elfos.h ${tm_file} \
 	         gnu-user.h linux.h glibc-stdint.h frv/linux.h"
-	tm_file="${tm_file} ../../libgcc/config/frv/frv-abi.h"
+	libgcc_tm_file="${libgcc_tm_file} frv/frv-abi.h"
 	tmake_file="${tmake_file} frv/t-frv frv/t-linux"
 	;;
 moxie-*-elf)
@@ -2197,7 +2205,8 @@ 
 	extra_headers=altivec.h
 	;;
 rx-*-elf*)
-	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} ../../libgcc/config/rx/rx-abi.h"
+	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+	libgcc_tm_file="${libgcc_tm_file} rx/rx-abi.h"
 	tmake_file="${tmake_file} rx/t-rx"
 	;;
 s390-*-linux*)
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 173509)
+++ gcc/Makefile.in	(working copy)
@@ -484,6 +484,8 @@ 
 tm_file_list=@tm_file_list@
 tm_include_list=@tm_include_list@
 tm_defines=@tm_defines@
+libgcc_tm_file_list=@libgcc_tm_file_list@
+libgcc_tm_include_list=@libgcc_tm_include_list@
 tm_p_file_list=@tm_p_file_list@
 tm_p_include_list=@tm_p_include_list@
 build_xm_file_list=@build_xm_file_list@
@@ -840,7 +842,8 @@ 
 TCONFIG_H = tconfig.h $(xm_file_list)
 TM_P_H    = tm_p.h    $(tm_p_file_list)
 GTM_H     = tm.h      $(tm_file_list) insn-constants.h
-TM_H      = $(GTM_H) insn-flags.h $(OPTIONS_H)
+TM_H      = $(GTM_H) libgcc_tm.h $(libgcc_tm_file_list) insn-flags.h \
+	$(OPTIONS_H)
 
 # Variables for version information.
 BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
@@ -1687,6 +1690,7 @@ 
 bconfig.h: cs-bconfig.h ; @true
 tconfig.h: cs-tconfig.h ; @true
 tm.h: cs-tm.h ; @true
+libgcc_tm.h: cs-libgcc_tm.h ; @true
 tm_p.h: cs-tm_p.h ; @true
 
 cs-config.h: Makefile
@@ -1709,6 +1713,11 @@ 
 	HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
 	$(SHELL) $(srcdir)/mkconfig.sh tm.h
 
+cs-libgcc_tm.h: Makefile
+	TARGET_CPU_DEFAULT="" \
+	HEADERS="$(libgcc_tm_include_list)" DEFINES="" \
+	$(SHELL) $(srcdir)/mkconfig.sh libgcc_tm.h
+
 cs-tm_p.h: Makefile
 	TARGET_CPU_DEFAULT="" \
 	HEADERS="$(tm_p_include_list)" DEFINES="" \
@@ -4464,7 +4473,7 @@ 
 	-rm -f libgcc.a libgcc_eh.a libgcov.a
 	-rm -f libgcc_s*
 	-rm -f libunwind*
-	-rm -f config.h tconfig.h bconfig.h tm_p.h tm.h
+	-rm -f config.h tconfig.h bconfig.h tm_p.h tm.h libgcc_tm.h
 	-rm -f options.c options.h optionlist
 	-rm -f cs-*
 	-rm -f doc/*.dvi
Index: gcc/config/arm/symbian.h
===================================================================
--- gcc/config/arm/symbian.h	(revision 173509)
+++ gcc/config/arm/symbian.h	(working copy)
@@ -1,5 +1,5 @@ 
 /* Configuration file for Symbian OS on ARM processors.
-   Copyright (C) 2004, 2005, 2007, 2008
+   Copyright (C) 2004, 2005, 2007, 2008, 2011
    Free Software Foundation, Inc.
    Contributed by CodeSourcery, LLC   
 
@@ -71,11 +71,6 @@ 
 #define SUBTARGET_ASM_FLOAT_SPEC \
   "%{!mfpu=*:-mfpu=vfp} %{!mcpu=*:%{!march=*:-march=armv5t}}"
   
-/* SymbianOS provides the BPABI routines in a separate library.
-   Therefore, we do not need to define any of them in libgcc.  */
-#undef RENAME_LIBRARY
-#define RENAME_LIBRARY(GCC_NAME, AEABI_NAME) /* empty */
-
 /* Define the __symbian__ macro.  */
 #undef TARGET_OS_CPP_BUILTINS
 #define TARGET_OS_CPP_BUILTINS()				\