Difference between revisions of "Porting/Macros"
Jump to navigation
Jump to search
Line 32: | Line 32: | ||
Examples from Debian ppc64le packages: | Examples from Debian ppc64le packages: | ||
+ | |||
+ | ''libtbb-dev, version 2020.3-1, /usr/include/tbb/machine/gcc_arm.h:'' | ||
<pre> | <pre> | ||
− | |||
− | |||
#if __powerpc64__ || __ppc64__ | #if __powerpc64__ || __ppc64__ | ||
// IBM XL documents __powerpc64__ (and __PPC64__). | // IBM XL documents __powerpc64__ (and __PPC64__). |
Revision as of 11:25, 13 September 2023
Some projects have been ported to Apple ppc64. In that case, they may test macros like this:
#if defined(__ppc64__) #endif
GCC does not define __ppc64__ (lowercase). It defines __PPC64__ (uppercase). To make the above code also build on Debian ppc64le or ppc64 (big endian) change the above code to:
#if defined(__ppc64__) || defined(__PPC64__) #endif
Details discussed on #talos-workstation:
Apple's gcc (4.0.1) in MacOS 10.5, ppc32 headers define:
__POWERPC__ and __ppc__
with -m64, the following are defined:
__POWERPC__, __ppc__, and __ppc64__
GCC compiling for the Linux kernel defines, for ppc32:
__PPC__ and __powerpc__
and for ppc64:
__PPC__, __powerpc__, __PPC64__ and __powerpc64__
Examples from Debian ppc64le packages:
libtbb-dev, version 2020.3-1, /usr/include/tbb/machine/gcc_arm.h:
#if __powerpc64__ || __ppc64__ // IBM XL documents __powerpc64__ (and __PPC64__). // Apple documents __ppc64__ (with __ppc__ only on 32-bit). #define __TBB_WORDSIZE 8 #else #define __TBB_WORDSIZE 4 #endif