Danny Backx escreveu:
Pedro,The commit described below moves the _M_ARM definitions from gcc internals into an include file. For the _M_ARM, this is clearly something that needed to be done : its value depends on it, you cannot do this easily in the gcc internals. I am wondering why we would need to do this for the ARM macro though. The downside of this is that some sources need to either include winnt.h or implement the same processing, none of which seems necessary. My feeling is to move the definition of ARM back into the gcc config, but maybe I'm missing something ?
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.
Cheers, Pedro Alves
Index: ChangeLog.ce =================================================================== --- ChangeLog.ce (revision 830) +++ ChangeLog.ce (working copy) @@ -1,3 +1,12 @@ +2006-12-03 Pedro Alves <[EMAIL PROTECTED]> + + * 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 <[EMAIL PROTECTED]> * config/arm/mingw32.h (STARTFILE_SPEC): Add crt3.o and dllcrt3.o Index: config/arm/arm.c =================================================================== --- config/arm/arm.c (revision 760) +++ config/arm/arm.c (working copy) @@ -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" Index: config/arm/arm-protos.h =================================================================== --- config/arm/arm-protos.h (revision 760) +++ config/arm/arm-protos.h (working copy) @@ -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 ([EMAIL PROTECTED]) Minor hacks by Nick Clifton ([EMAIL PROTECTED]) @@ -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); Index: config/arm/wince-pe.h =================================================================== --- config/arm/wince-pe.h (revision 792) +++ config/arm/wince-pe.h (working copy) @@ -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. */
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel