[RESEND] [PATCH] Better vxWorks support in longlong.h

Mark Haigh mhaigh at sonicwall.com
Fri Mar 19 02:19:31 CET 2004

Torbjorn Granlund wrote:

>Mark Haigh <mhaigh at sonicwall.com> writes:
>  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 GMP team works around a lot of bugs and weirdnesses on
>various systems, but this weirdness strikes me as too much even
>for us.  If VxWorks asks for PPC, they should get it.
>Please report this problem to Windriver instead.
Earlier versions of GCC (2.x) for Linux predefined PPC as a builtin 
define -- something it should not have done, as that macro is in the 
user namespace.  This has been changed in newer versions of GCC to 
__PPC__.  The problem is that 2.x versions of GCC are still in wide 
usage, otherwise the patch would be extremely simple.

The patch here is a little strange, but it's backwards compatible with 
2.x GCC for PPC Linux and is also compatible with the many thousands of 
existing installations of vxWorks 5.4 and 5.5.  When GCC 2.x is no 
longer in widespread use, everything gets much, much simpler.

Your code says:

   FIXME: What's needed for gcc PowerPC VxWorks?  __vxworks__ is not good
   enough, since that hits ARM and m68k too.  */

Well, here's something that should fix it.  It fixes all vxWorks builds, 
preserves backwards compatibility with existing PPC Linux installations, 
and weighs in at *5* lines of non-formatting changes to *one* file.

Is that really so terrible?  Like I said, I'm trying to work with you 
here to get something that is acceptable to both the gcc guys and the 
gmp guys.  If there's something you'd rather see instead, simply let me 
know and I'll work on it.  However, I think this is an easy change that 
will really help out anybody that is stuck using vxWorks.

Mark F. Haigh
mfhaigh at acm.org

More information about the gmp-bugs mailing list