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] Small vxWorks fixes for 3.3.3 branch (bug #13873)



2004-03-04 Mark F. Haigh <mfhaigh@acm.org>


   * longlong.h: vxWorks-related fixes.
   * config/rs6000/vxppc.h:  Add __ppc_vxworks builtin define.


I took a cue from the alpha vxworks (__alpha_vxworks), and added __ppc_vxworks as a builtin define in rs6000/vxppc.h. This allowed a nice cleanup of gcc/longlong.h, and fixed a TODO in there in the process.


The crux of the problem is that vxWorks always defines the PPC macro, and this conflicts with the GNU/Linux and SysV usage of PPC. The solution here is to always undef PPC for vxWorks targets (so nobody is confused), and use __ppc_vxworks for vxWorks-related stuff.

I think this is the best approach, but if there's a preferred way I did not think of, let me know and I'll do it for you, no problem.

Thanks,

Mark F. Haigh
mfhaigh@acm.org

Index: gcc/gcc/longlong.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/longlong.h,v
retrieving revision 1.33
diff -c -3 -p -r1.33 longlong.h
*** gcc/gcc/longlong.h	3 Oct 2002 20:39:08 -0000	1.33
--- gcc/gcc/longlong.h	5 Mar 2004 00:25:16 -0000
***************
*** 107,112 ****
--- 107,118 ----
  #define __AND_CLOBBER_CC , "cc"
  #endif /* __GNUC__ < 2 */
  
+ /* Under vxWorks, PPC is always defined.  This conflicts with the GNU/Linux
+  * and SysV usage of PPC, so we undef it.  Use __ppc_vxworks instead.  */
+ #if defined(__vxworks) || defined(__vxworks__)
+ #undef PPC
+ #endif
+ 
  #if defined (__alpha) && W_TYPE_SIZE == 64
  #define umul_ppmm(ph, pl, m0, m1) \
    do {									\
*************** UDItype __umulsidi3 (USItype, USItype);
*** 605,613 ****
  #endif /* __ns32000__ */
  
  /* FIXME: We should test _IBMR2 here when we add assembly support for the
!    system vendor compilers.
!    FIXME: What's needed for gcc PowerPC VxWorks?  __vxworks__ is not good
!    enough, since that hits ARM and m68k too.  */
  #if (defined (_ARCH_PPC)	/* AIX */				\
       || defined (_ARCH_PWR)	/* AIX */				\
       || defined (_ARCH_COM)	/* AIX */				\
--- 611,617 ----
  #endif /* __ns32000__ */
  
  /* FIXME: We should test _IBMR2 here when we add assembly support for the
!    system vendor compilers.  */
  #if (defined (_ARCH_PPC)	/* AIX */				\
       || defined (_ARCH_PWR)	/* AIX */				\
       || defined (_ARCH_COM)	/* AIX */				\
*************** UDItype __umulsidi3 (USItype, USItype);
*** 615,620 ****
--- 619,625 ----
       || defined (__POWERPC__)	/* BEOS */				\
       || defined (__ppc__)	/* Darwin */				\
       || defined (PPC)		/* GNU/Linux, SysV */			\
+      || defined (__ppc_vxworks)	/* vxWorks */				\
       ) && W_TYPE_SIZE == 32
  #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
    do {									\
*************** UDItype __umulsidi3 (USItype, USItype);
*** 652,658 ****
    __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x))
  #define COUNT_LEADING_ZEROS_0 32
  #if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \
!   || defined (__ppc__) || defined (PPC) || defined (__vxworks__)
  #define umul_ppmm(ph, pl, m0, m1) \
    do {									\
      USItype __m0 = (m0), __m1 = (m1);					\
--- 657,663 ----
    __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x))
  #define COUNT_LEADING_ZEROS_0 32
  #if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \
!   || defined (__ppc__) || defined (PPC) || defined (__ppc_vxworks)
  #define umul_ppmm(ph, pl, m0, m1) \
    do {									\
      USItype __m0 = (m0), __m1 = (m1);					\
Index: gcc/gcc/config/rs6000/vxppc.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/rs6000/Attic/vxppc.h,v
retrieving revision 1.10
diff -c -3 -p -r1.10 vxppc.h
*** gcc/gcc/config/rs6000/vxppc.h	10 Jul 2002 00:33:51 -0000	1.10
--- gcc/gcc/config/rs6000/vxppc.h	5 Mar 2004 00:25:17 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 45,50 ****
--- 45,51 ----
      {                                     \
        builtin_define ("__vxworks");       \
        builtin_define ("__vxworks__");     \
+       builtin_define ("__ppc_vxworks");   \
        builtin_assert ("system=vxworks");  \
        builtin_assert ("system=embedded"); \
        builtin_assert ("cpu=powerpc");     \

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