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: [PING] PPC macro usage patch (PR 13873)



[Originally sent to gmp-devel@swox.com and gmp-bugs@swox.com. Are they still alive over there? No responses, and my mails have not appeared in the archive. Looking at it, the last release was several years ago, and they have not rolled up any of the numerous patches people have submitted into any cohesive release, and they don't say where their development tree is. At any rate, the patch below is quite different than the one submitted here (gmp must remain backward compatible with old versions of gcc), but this should work for both gcc and gmp. Can anybody direct this at the right person?]



Hello,


Here's a patch for better vxWorks support in longlong.h. It fixes the FIXME for vxWorks PPC in there as well.

The problem with the way longlong.h is currently set up is that the PPC macro is used to determine whether we're running on GNU/Linux or SysV. However, this usage is ambiguous because vxWorks always defines PPC, regardless of the actual target architecture. When compiling under vxWorks, this causes longlong.h to unconditionally emit powerpc assembly, causing breakage on all non-PPC targets.

The patch here is as minimal and uninvasive as possible. I'm working with the gcc folks to get something that's acceptable to everyone, because currently gcc will not build for any non-PPC vxWorks platforms without a bit of manual hackery.

The patch is against the 4.1.2 release. I would appreciate it's inclusion so I can get the vxWorks gcc builds working again. If there's anything you would like done differently, please let me know.

Thanks,


Mark F. Haigh mfhaigh@acm.org



*** longlong.h.orig	Tue Mar  9 14:45:34 2004
--- longlong.h	Tue Mar  9 18:43:29 2004
*************** MA 02111-1307, USA. */
*** 37,42 ****
--- 37,54 ----
  #define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
  #define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
  
+ /* VxWorks always defines PPC, even for non-PPC targets.  This conflicts 
+    with GNU/Linux and SysV usage.  Here we resolve the ambiguity.  */
+ #ifdef PPC
+ #if (defined(__vxworks) || defined(__vxworks__)) && defined(CPU_FAMILY)
+ #if CPU_FAMILY == PPC		/* VxWorks defined PPC.  Check CPU family. */
+ #define __PPC_VXWORKS		/* We are VxWorks for PPC */
+ #endif
+ #else
+ #define __PPC_LINUX_OR_SYSV	/* Not VxWorks, must be GNU/Linux or SysV. */
+ #endif
+ #endif
+ 
  /* This is used to make sure no undesirable sharing between different libraries
     that use this file takes place.  */
  #ifndef __MPN
*************** extern UWtype __MPN(udiv_qrnnd) _PROTO (
*** 955,969 ****
  #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 (__powerpc__)	/* gcc */				\
!      || defined (__POWERPC__)	/* BEOS */				\
!      || defined (__ppc__)	/* Darwin */				\
!      || defined (PPC)		/* GNU/Linux, SysV */			\
       ) && W_TYPE_SIZE == 32
  #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
    do {									\
--- 967,980 ----
  #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 (__powerpc__)		/* gcc */			\
!      || defined (__POWERPC__)		/* BEOS */			\
!      || defined (__ppc__)		/* Darwin */			\
!      || defined (__PPC_LINUX_OR_SYSV)	/* GNU/Linux, SysV */		\
!      || defined (__PPC_VXWORKS) 	/* VxWorks */			\
       ) && W_TYPE_SIZE == 32
  #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
    do {									\
*************** extern UWtype __MPN(udiv_qrnnd) _PROTO (
*** 1001,1007 ****
    __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);					\
--- 1012,1019 ----
    __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_LINUX_OR_SYSV)			\
!   || defined (__PPC_VXWORKS)
  #define umul_ppmm(ph, pl, m0, m1) \
    do {									\
      USItype __m0 = (m0), __m1 = (m1);					\

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