From: <dan...@us...> - 2006-12-05 19:09:45
|
Revision: 838 http://svn.sourceforge.net/cegcc/?rev=838&view=rev Author: dannybackx Date: 2006-12-05 11:09:44 -0800 (Tue, 05 Dec 2006) Log Message: ----------- This is Pedro's fix for the ARM macro definition, I'm committing it for him as he indicated. Here is the patch that moves _M_ARM and ARM back into gcc builtins, and adds _M_ARMT. _M_ARM and _M_ARMT will be defined to the arm arch being compiled to, _M_ARMT will only be defined if the arm arch supports thumb, and ARM will be defined as empty. I think this matches MSFT's tools behavior. I've tested it manually using -march=armv4, -march=armv5, etc, and with -mcpu=arm8, -mcpu=xscale, etc. I will commit it later if you confirm it works for you, or you can commit it yourself if you want. Modified Paths: -------------- trunk/cegcc/src/gcc/gcc/ChangeLog.ce trunk/cegcc/src/gcc/gcc/config/arm/arm-protos.h trunk/cegcc/src/gcc/gcc/config/arm/arm.c trunk/cegcc/src/gcc/gcc/config/arm/wince-pe.h Modified: trunk/cegcc/src/gcc/gcc/ChangeLog.ce =================================================================== --- trunk/cegcc/src/gcc/gcc/ChangeLog.ce 2006-12-04 21:47:24 UTC (rev 837) +++ trunk/cegcc/src/gcc/gcc/ChangeLog.ce 2006-12-05 19:09:44 UTC (rev 838) @@ -1,3 +1,12 @@ +2006-12-03 Pedro Alves <ped...@po...> + + * config/arm/arm.c (arm_major_arch, arm_thumb_arch_p): New + functions. + * config/arm/arm-protos.h (arm_major_arch, arm_thumb_arch_p): + Declare. + * config/arm/wince-pe.h (TARGET_OS_CPP_BUILTINS): Add _M_ARM, + _M_ARMT and ARM. + 2006-11-27 Pedro Alves <ped...@po...> * config/arm/mingw32.h (STARTFILE_SPEC): Add crt3.o and dllcrt3.o Modified: trunk/cegcc/src/gcc/gcc/config/arm/arm-protos.h =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/arm-protos.h 2006-12-04 21:47:24 UTC (rev 837) +++ trunk/cegcc/src/gcc/gcc/config/arm/arm-protos.h 2006-12-05 19:09:44 UTC (rev 838) @@ -1,5 +1,6 @@ -/* Prototypes for exported functions defined in arm.c and pe.c - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +/* Prototypes for exported functions defined in arm.c, pe.c, + pe-cxx.c and pe-stubs.c. + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rea...@ar...) Minor hacks by Nick Clifton (ni...@cy...) @@ -42,6 +43,9 @@ extern void arm_output_fn_unwind (FILE *, bool); extern void arm_file_end (void); +int arm_major_arch (void); +bool arm_thumb_arch_p (void); + #ifdef TREE_CODE extern int arm_return_in_memory (tree); extern void arm_encode_call_attribute (tree, int); Modified: trunk/cegcc/src/gcc/gcc/config/arm/arm.c =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/arm.c 2006-12-04 21:47:24 UTC (rev 837) +++ trunk/cegcc/src/gcc/gcc/config/arm/arm.c 2006-12-05 19:09:44 UTC (rev 838) @@ -15529,4 +15529,28 @@ || lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (record_type)); } +int +arm_major_arch (void) +{ + if ((insn_flags & FL_FOR_ARCH6) == FL_FOR_ARCH6) + return 6; + else if ((insn_flags & FL_FOR_ARCH5) == FL_FOR_ARCH5) + return 5; + else if ((insn_flags & FL_FOR_ARCH4) == FL_FOR_ARCH4) + return 4; + else if ((insn_flags & FL_FOR_ARCH3) == FL_FOR_ARCH3) + return 3; + else if ((insn_flags & FL_FOR_ARCH2) == FL_FOR_ARCH2) + return 2; + + /* This should gives us a nice ICE somewhere. */ + return -1; +} + +bool +arm_thumb_arch_p (void) +{ + return (insn_flags & FL_THUMB) == FL_THUMB; +} + #include "gt-arm.h" Modified: trunk/cegcc/src/gcc/gcc/config/arm/wince-pe.h =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/wince-pe.h 2006-12-04 21:47:24 UTC (rev 837) +++ trunk/cegcc/src/gcc/gcc/config/arm/wince-pe.h 2006-12-05 19:09:44 UTC (rev 838) @@ -92,7 +92,21 @@ to compare typeinfo symbols across dll boundaries. */ \ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ EXTRA_OS_CPP_BUILTINS (); \ - } \ + { \ + /* Define these to be compatible MSFT's tools. */ \ + char buf[64]; \ + int arch = arm_major_arch (); \ + sprintf (buf, "_M_ARM=%d", arch); \ + builtin_define (buf); \ + if (arm_thumb_arch_p ()) \ + { \ + sprintf (buf, "_M_ARMT=%d", arch); \ + builtin_define (buf); \ + } \ + /* Always defined as empty. */ \ + builtin_define ("ARM="); \ + } \ + } \ while (0) /* Now we define the strings used to build the spec file. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |