Difference between revisions of "Porting/Macros"
Jump to navigation
Jump to search
m |
|||
Line 12: | Line 12: | ||
#endif | #endif | ||
</pre> | </pre> | ||
+ | |||
+ | Details discussed on #talos-workstation: | ||
+ | |||
+ | Apple's gcc (4.0.1) in MacOS 10.5, ppc32 headers define: | ||
+ | |||
+ | <pre>__POWERPC__ and __ppc__</pre> | ||
+ | |||
+ | with <pre>-m64</pre>, the following are defined: | ||
+ | |||
+ | <pre>__POWERPC__, __ppc__, and __ppc64__</pre> | ||
+ | |||
+ | GCC compiling for the Linux kernel defines, for ppc32: | ||
+ | |||
+ | <pre>__PPC__ and __powerpc__</pre> [https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/rs6000/linux.h;h=8dc2a89684a29ff05f6f5a17a280eb29129db229;hb=HEAD#l57 gcc/config/rs6000/linux.h] | ||
+ | |||
+ | and for ppc64: | ||
+ | |||
+ | <pre>__PPC__, __powerpc__, __PPC64__ and __powerpc64__</pre> [https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/rs6000/linux64.h;h=98b7255c95f1b55ec5c97726cfcb9dc6fb9ebf56;hb=HEAD#l293 gcc/config/rs6000/linux64.h] |
Revision as of 11:18, 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__