[compiler-rt] 0f91ec2 - [builtins] Canonicalize PowerPC detection macros to __powerpc__

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 17:34:08 PST 2022


Author: Fangrui Song
Date: 2022-11-06T17:34:04-08:00
New Revision: 0f91ec243d6ddb1f8b1f80d15f9003e5f06b0a21

URL: https://github.com/llvm/llvm-project/commit/0f91ec243d6ddb1f8b1f80d15f9003e5f06b0a21
DIFF: https://github.com/llvm/llvm-project/commit/0f91ec243d6ddb1f8b1f80d15f9003e5f06b0a21.diff

LOG: [builtins] Canonicalize PowerPC detection macros to __powerpc__

The lowercase __ppc__ is not defined by Linux GCC, therefore it lures
users to write code which is not portable to GCC. Migrate to __powerpc__ in
preparation for undefining __ppc__. __powerpc__ is much more common than
__PPC__.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/apple_versioning.c
    compiler-rt/lib/builtins/trampoline_setup.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/apple_versioning.c b/compiler-rt/lib/builtins/apple_versioning.c
index f87b42820c154..83d419418f241 100644
--- a/compiler-rt/lib/builtins/apple_versioning.c
+++ b/compiler-rt/lib/builtins/apple_versioning.c
@@ -138,13 +138,13 @@ NOT_HERE_BEFORE_10_6(__udivti3)
 NOT_HERE_BEFORE_10_6(__umoddi3)
 NOT_HERE_BEFORE_10_6(__umodti3)
 
-#if __ppc__
+#if __powerpc__
 NOT_HERE_BEFORE_10_6(__gcc_qadd)
 NOT_HERE_BEFORE_10_6(__gcc_qdiv)
 NOT_HERE_BEFORE_10_6(__gcc_qmul)
 NOT_HERE_BEFORE_10_6(__gcc_qsub)
 NOT_HERE_BEFORE_10_6(__trampoline_setup)
-#endif // __ppc__
+#endif // __powerpc__
 
 NOT_HERE_IN_10_8_AND_EARLIER(__atomic_compare_exchange)
 NOT_HERE_IN_10_8_AND_EARLIER(__atomic_compare_exchange_1)

diff  --git a/compiler-rt/lib/builtins/trampoline_setup.c b/compiler-rt/lib/builtins/trampoline_setup.c
index a62431723d787..844eb27944142 100644
--- a/compiler-rt/lib/builtins/trampoline_setup.c
+++ b/compiler-rt/lib/builtins/trampoline_setup.c
@@ -16,7 +16,7 @@ extern void __clear_cache(void *start, void *end);
 // which loads r11 with a pointer to the outer function's locals
 // and then jumps to the target nested function.
 
-#if __ppc__ && !defined(__powerpc64__)
+#if __powerpc__ && !defined(__powerpc64__)
 COMPILER_RT_ABI void __trampoline_setup(uint32_t *trampOnStack,
                                         int trampSizeAllocated,
                                         const void *realFunc, void *localsPtr) {
@@ -40,4 +40,4 @@ COMPILER_RT_ABI void __trampoline_setup(uint32_t *trampOnStack,
   // clear instruction cache
   __clear_cache(trampOnStack, &trampOnStack[10]);
 }
-#endif // __ppc__ && !defined(__powerpc64__)
+#endif // __powerpc__ && !defined(__powerpc64__)


        


More information about the llvm-commits mailing list