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]

Re: [RFA] Update some of arm/ to new CPP builtins


Richard Earnshaw wrote:-

> You've missed out the define that gets added for the combination of 
> -mbig-endian and -mwords-little-endian.
> 
> Other than that, this is OK.

Ah, well spotted, thanks.  I also had one test using the FLAGS
macro rather than the target macro.

This is the final patch I'll commit.

Neil.

config:
	* arm/arm.h (TARGET_CPU_CPP_BUILTINS): Define.
	(CPP_SPEC): Update.
	(CPP_APCS_PC_SPEC, CPP_APCS_PC_DEFAULT_SPEC,
	CPP_FLOAT_SPEC, CPP_FLOAT_DEFAULT_SPEC, CPP_ENDIAN_SPEC,
	CPP_ENDIAN_DEFAULT_SPEC, CPP_INTERWORK_DEFAULT_SPEC,
	CPP_INTERWORK_SPEC, CPP_PREDEFINES): Remove.
	(EXTRA_SPECS): Update.
	* arm/conix-elf.h, arm/linux-elf.h, arm/netbsd.h, arm/riscix.h,
	arm/riscix1-1.h, arm/rtems-elf.h, arm/semiaof.h, arm/unknown-elf.h,
	arm/unknown-elf-oabi.h, arm/vxarm.h: Remove CPP_PREDEFINES and
	define TARGET_OS_CPP_BUILTINS if necessary.

============================================================
Index: gcc/config/arm/arm.h
*** gcc/config/arm/arm.h	13 Mar 2002 05:42:33 -0000	1.145
--- gcc/config/arm/arm.h	14 May 2002 17:15:26 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 26,31 ****
--- 26,72 ----
  #ifndef GCC_ARM_H
  #define GCC_ARM_H
  
+ /* Target CPU builtins.  */
+ #define TARGET_CPU_CPP_BUILTINS()			\
+   do							\
+     {							\
+ 	if (TARGET_THUMB)				\
+ 	  builtin_define ("__arm__");			\
+ 	else						\
+ 	  builtin_define ("__thumb__");			\
+ 							\
+ 	if (TARGET_BIG_END)				\
+ 	  {						\
+ 	    builtin_define ("__ARMEB__");		\
+ 	    if (TARGET_THUMB)				\
+ 	      builtin_define ("__THUMBEB__");		\
+ 	    if (TARGET_LITTLE_WORDS)			\
+ 	      builtin_define ("__ARMWEL__");		\
+ 	  }						\
+         else						\
+ 	  {						\
+ 	    builtin_define ("__ARMEL__");		\
+ 	    if (TARGET_THUMB)				\
+ 	      builtin_define ("__THUMBEL__");		\
+ 	  }						\
+ 							\
+ 	if (TARGET_APCS_32)				\
+ 	  builtin_define ("__APCS_32__");		\
+ 	else						\
+ 	  builtin_define ("__APCS_26__");		\
+ 							\
+ 	if (TARGET_SOFT_FLOAT)				\
+ 	  builtin_define ("__SOFTFP__");		\
+ 							\
+ 	/* Add a define for interworking.		\
+ 	   Needed when building libgcc.a.  */		\
+ 	if (TARGET_INTERWORK)				\
+ 	  builtin_define ("__THUMB_INTERWORK__");	\
+ 							\
+ 	builtin_assert ("cpu=arm");			\
+ 	builtin_assert ("machine=arm");			\
+     } while (0)
+ 
  #define TARGET_CPU_arm2		0x0000
  #define TARGET_CPU_arm250	0x0000
  #define TARGET_CPU_arm3		0x0000
*************** Unrecognized value in TARGET_CPU_DEFAULT
*** 126,141 ****
  #endif
  
  #undef  CPP_SPEC
! #define CPP_SPEC "\
! %(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) \
! %(cpp_endian) %(subtarget_cpp_spec) %(cpp_isa) %(cpp_interwork)"
! 
! #define CPP_ISA_SPEC "%{mthumb:-D__thumb__} %{!mthumb:-D__arm__}"
  
  /* Set the architecture define -- if -march= is set, then it overrides
     the -mcpu= setting.  */
  #define CPP_CPU_ARCH_SPEC "\
- -Acpu=arm -Amachine=arm \
  %{march=arm2:-D__ARM_ARCH_2__} \
  %{march=arm250:-D__ARM_ARCH_2__} \
  %{march=arm3:-D__ARM_ARCH_2__} \
--- 167,183 ----
  #endif
  
  #undef  CPP_SPEC
! #define CPP_SPEC "%(cpp_cpu_arch) %(subtarget_cpp_spec)			\
! %{mapcs-32:%{mapcs-26:							\
! 	%e-mapcs-26 and -mapcs-32 may not be used together}}		\
! %{msoft-float:%{mhard-float:						\
! 	%e-msoft-float and -mhard_float may not be used together}}	\
! %{mbig-endian:%{mlittle-endian:						\
! 	%e-mbig-endian and -mlittle-endian may not be used together}}"
  
  /* Set the architecture define -- if -march= is set, then it overrides
     the -mcpu= setting.  */
  #define CPP_CPU_ARCH_SPEC "\
  %{march=arm2:-D__ARM_ARCH_2__} \
  %{march=arm250:-D__ARM_ARCH_2__} \
  %{march=arm3:-D__ARM_ARCH_2__} \
*************** Unrecognized value in TARGET_CPU_DEFAULT
*** 206,263 ****
   %{!mcpu*:%(cpp_cpu_arch_default)}} \
  "
  
- /* Define __APCS_26__ if the PC also contains the PSR */
- #define CPP_APCS_PC_SPEC "\
- %{mapcs-32:%{mapcs-26:%e-mapcs-26 and -mapcs-32 may not be used together} \
-  -D__APCS_32__} \
- %{mapcs-26:-D__APCS_26__} \
- %{!mapcs-32: %{!mapcs-26:%(cpp_apcs_pc_default)}} \
- "
- 
- #ifndef CPP_APCS_PC_DEFAULT_SPEC
- #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_26__"
- #endif
- 
- #define CPP_FLOAT_SPEC "\
- %{msoft-float:\
-   %{mhard-float:%e-msoft-float and -mhard_float may not be used together} \
-   -D__SOFTFP__} \
- %{!mhard-float:%{!msoft-float:%(cpp_float_default)}} \
- "
- 
- /* Default is hard float, which doesn't define anything */
- #define CPP_FLOAT_DEFAULT_SPEC ""
- 
- #define CPP_ENDIAN_SPEC "\
- %{mbig-endian:								\
-   %{mlittle-endian:							\
-     %e-mbig-endian and -mlittle-endian may not be used together}	\
-   -D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__} %{mthumb:-D__THUMBEB__}}\
- %{mlittle-endian:-D__ARMEL__ %{mthumb:-D__THUMBEL__}}			\
- %{!mlittle-endian:%{!mbig-endian:%(cpp_endian_default)}}		\
- "
- 
- /* Default is little endian.  */
- #define CPP_ENDIAN_DEFAULT_SPEC "-D__ARMEL__ %{mthumb:-D__THUMBEL__}"
- 
- /* Add a define for interworking.  Needed when building libgcc.a.  
-    This must define __THUMB_INTERWORK__ to the pre-processor if
-    interworking is enabled by default.  */
- #ifndef CPP_INTERWORK_DEFAULT_SPEC
- #define CPP_INTERWORK_DEFAULT_SPEC ""
- #endif
- 
- #define CPP_INTERWORK_SPEC "						\
- %{mthumb-interwork:							\
-   %{mno-thumb-interwork: %eincompatible interworking options}		\
-   -D__THUMB_INTERWORK__}						\
- %{!mthumb-interwork:%{!mno-thumb-interwork:%(cpp_interwork_default)}}	\
- "
- 
- #ifndef CPP_PREDEFINES
- #define CPP_PREDEFINES ""
- #endif
- 
  #ifndef CC1_SPEC
  #define CC1_SPEC ""
  #endif
--- 248,253 ----
*************** Unrecognized value in TARGET_CPU_DEFAULT
*** 274,288 ****
  #define EXTRA_SPECS						\
    { "cpp_cpu_arch",		CPP_CPU_ARCH_SPEC },		\
    { "cpp_cpu_arch_default",	CPP_ARCH_DEFAULT_SPEC },	\
-   { "cpp_apcs_pc",		CPP_APCS_PC_SPEC },		\
-   { "cpp_apcs_pc_default",	CPP_APCS_PC_DEFAULT_SPEC },	\
-   { "cpp_float",		CPP_FLOAT_SPEC },		\
-   { "cpp_float_default",	CPP_FLOAT_DEFAULT_SPEC },	\
-   { "cpp_endian",		CPP_ENDIAN_SPEC },		\
-   { "cpp_endian_default",	CPP_ENDIAN_DEFAULT_SPEC },	\
-   { "cpp_isa",			CPP_ISA_SPEC },			\
-   { "cpp_interwork",		CPP_INTERWORK_SPEC },		\
-   { "cpp_interwork_default",	CPP_INTERWORK_DEFAULT_SPEC },	\
    { "subtarget_cpp_spec",	SUBTARGET_CPP_SPEC },           \
    SUBTARGET_EXTRA_SPECS
  
--- 264,269 ----
============================================================
Index: gcc/config/arm/conix-elf.h
*** gcc/config/arm/conix-elf.h	13 Dec 2001 00:27:30 -0000	1.10
--- gcc/config/arm/conix-elf.h	14 May 2002 17:15:26 -0000
*************** the Free Software Foundation, 59 Temple 
*** 39,44 ****
  #define SUBTARGET_CPU_DEFAULT 		TARGET_CPU_arm7tdmi
  #endif
       
! #undef  CPP_PREDEFINES
! #define CPP_PREDEFINES \
!   "-D__arm__ -D__CONIX__ -D__ELF__"
--- 39,46 ----
  #define SUBTARGET_CPU_DEFAULT 		TARGET_CPU_arm7tdmi
  #endif
       
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define ("__CONIX__");		\
! 	builtin_define ("__ELF__");		\
!     } while (0)
============================================================
Index: gcc/config/arm/linux-elf.h
*** gcc/config/arm/linux-elf.h	15 Apr 2002 20:35:09 -0000	1.33
--- gcc/config/arm/linux-elf.h	14 May 2002 17:15:26 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 89,98 ****
     %{mbig-endian:-EB}" \
     SUBTARGET_EXTRA_LINK_SPEC
  
! #undef  CPP_PREDEFINES
! #define CPP_PREDEFINES \
! "-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ \
! -Asystem=unix -Asystem=posix"
  
  /* Allow #sccs in preprocessor.  */
  #define SCCS_DIRECTIVE
--- 89,103 ----
     %{mbig-endian:-EB}" \
     SUBTARGET_EXTRA_LINK_SPEC
  
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define_std ("unix");		\
! 	builtin_define_std ("linux");		\
! 	builtin_define ("__gnu_linux__");	\
! 	builtin_define ("__ELF__");		\
! 	builtin_assert ("system=unix");		\
! 	builtin_assert ("system=posix");	\
!     } while (0)
  
  /* Allow #sccs in preprocessor.  */
  #define SCCS_DIRECTIVE
============================================================
Index: gcc/config/arm/netbsd.h
*** gcc/config/arm/netbsd.h	5 Feb 2002 19:01:48 -0000	1.17
--- gcc/config/arm/netbsd.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 44,53 ****
  
  /* Some defines for CPP.
     arm32 is the NetBSD port name, so we always define arm32 and __arm32__.  */
! #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "\
! -Dunix -Driscbsd -Darm32 -D__arm32__ -D__arm__ -D__NetBSD__ \
! -Asystem=unix -Asystem=NetBSD"
  
  /* Define _POSIX_SOURCE if necessary.  */
  #undef CPP_SPEC
--- 44,58 ----
  
  /* Some defines for CPP.
     arm32 is the NetBSD port name, so we always define arm32 and __arm32__.  */
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define_std ("arm32");		\
! 	builtin_define_std ("unix");		\
! 	builtin_define_std ("riscbsd");		\
! 	builtin_define ("__NetBSD__");		\
! 	builtin_assert ("system=unix");		\
! 	builtin_assert ("system=NetBSD");	\
!     } while (0)
  
  /* Define _POSIX_SOURCE if necessary.  */
  #undef CPP_SPEC
============================================================
Index: gcc/config/arm/riscix.h
*** gcc/config/arm/riscix.h	13 Dec 2001 00:27:30 -0000	1.10
--- gcc/config/arm/riscix.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 47,57 ****
  #define LINK_SPEC "-X"
  #endif
  
! #ifndef CPP_PREDEFINES
! #define CPP_PREDEFINES  \
!     "-Darm -Driscix -Dunix -Asystem=unix"
! #endif
! 
  
  /* RISCiX has some weird symbol name munging, that is done to the object module
     after assembly, which enables multiple libraries to be supported within
--- 47,59 ----
  #define LINK_SPEC "-X"
  #endif
  
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define_std ("arm");		\
! 	builtin_define_std ("unix");		\
! 	builtin_define_std ("riscix");		\
! 	builtin_assert ("system=unix");		\
!     } while (0)
  
  /* RISCiX has some weird symbol name munging, that is done to the object module
     after assembly, which enables multiple libraries to be supported within
============================================================
Index: gcc/config/arm/riscix1-1.h
*** gcc/config/arm/riscix1-1.h	13 Dec 2001 00:27:30 -0000	1.8
--- gcc/config/arm/riscix1-1.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 29,37 ****
  #define STARTFILE_SPEC  \
    "%{pg:/usr/lib/gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
  
! #ifndef CPP_PREDEFINES
! #define CPP_PREDEFINES  "-Darm -Driscix -Dunix -Asystem=unix"
! #endif
  
  /* Riscix 1.1 doesn't have X/OPEN support, so only accept -mbsd (but ignore
     it).  
--- 29,41 ----
  #define STARTFILE_SPEC  \
    "%{pg:/usr/lib/gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
  
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define_std ("arm");		\
! 	builtin_define_std ("unix");		\
! 	builtin_define_std ("riscix");		\
! 	builtin_assert ("system=unix");		\
!     } while (0)
  
  /* Riscix 1.1 doesn't have X/OPEN support, so only accept -mbsd (but ignore
     it).  
============================================================
Index: gcc/config/arm/rtems-elf.h
*** gcc/config/arm/rtems-elf.h	1 May 2002 16:34:06 -0000	1.7
--- gcc/config/arm/rtems-elf.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 24,28 ****
  
  #define HAS_INIT_SECTION
  
! #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-D__rtems__ -D__ELF__ -Asystem=rtems"
--- 24,32 ----
  
  #define HAS_INIT_SECTION
  
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define ("__rtems__");		\
! 	builtin_define ("__ELF__");		\
! 	builtin_assert ("system=rtems");	\
!     } while (0)
============================================================
Index: gcc/config/arm/semiaof.h
*** gcc/config/arm/semiaof.h	13 Dec 2001 00:27:30 -0000	1.5
--- gcc/config/arm/semiaof.h	14 May 2002 17:15:27 -0000
*************** along with GNU CC; see the file COPYING.
*** 20,27 ****
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
! #define CPP_PREDEFINES \
!     "-Darm -Dsemi"
  
  #define ASM_SPEC "%{g -g} -arch 4 \
  -apcs 3%{mapcs-32:/32bit}%{mapcs-26:/26bit}%{!mapcs-26:%{!macps-32:/32bit}}"
--- 20,30 ----
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define_std ("arm");		\
! 	builtin_define_std ("semi");		\
!     } while (0)
  
  #define ASM_SPEC "%{g -g} -arch 4 \
  -apcs 3%{mapcs-32:/32bit}%{mapcs-26:/26bit}%{!mapcs-26:%{!macps-32:/32bit}}"
============================================================
Index: gcc/config/arm/unknown-elf-oabi.h
*** gcc/config/arm/unknown-elf-oabi.h	14 Sep 2001 10:19:30 -0000	1.4
--- gcc/config/arm/unknown-elf-oabi.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 23,31 ****
  #undef  TARGET_VERSION
  #define TARGET_VERSION	fputs (" (ARM/ELF non-Linux old abi)", stderr);
  
- #undef  CPP_PREDEFINES
- #define CPP_PREDEFINES "-Darm_oabi -Darm -Darm_elf -Acpu=arm -Amachine=arm -D__ELF__"
- 
  #undef  ASM_SPEC
  #define ASM_SPEC "-moabi %{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \
   %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork}"
--- 23,28 ----
============================================================
Index: gcc/config/arm/unknown-elf.h
*** gcc/config/arm/unknown-elf.h	15 Dec 2001 16:46:57 -0000	1.24
--- gcc/config/arm/unknown-elf.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 86,95 ****
      }									\
    while (0)
  
- #ifndef CPP_PREDEFINES
- #define CPP_PREDEFINES "-D__ELF__"
- #endif
- 
  #ifndef CPP_APCS_PC_DEFAULT_SPEC
  #define CPP_APCS_PC_DEFAULT_SPEC	"-D__APCS_32__"
  #endif
--- 86,91 ----
============================================================
Index: gcc/config/arm/vxarm.h
*** gcc/config/arm/vxarm.h	16 Nov 2001 21:23:16 -0000	1.6
--- gcc/config/arm/vxarm.h	14 May 2002 17:15:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 37,44 ****
    %{!mcpu*:%{!march=*:-DCPU=ARM710A}}	\
  "
  
! #undef  CPP_PREDEFINES
! #define CPP_PREDEFINES  "-D__vxworks -Acpu=arm -Amachine=arm"
  
  /* VxWorks does all the library stuff itself.  */
  #undef  LIB_SPEC
--- 37,46 ----
    %{!mcpu*:%{!march=*:-DCPU=ARM710A}}	\
  "
  
! #define TARGET_OS_CPP_BUILTINS()		\
!     do {					\
! 	builtin_define ("__vxworks");		\
!     } while (0)
  
  /* VxWorks does all the library stuff itself.  */
  #undef  LIB_SPEC


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