From 119347c55aa84a7f396f335ea48fb5912ef1b984 Mon Sep 17 00:00:00 2001
From: Fabian Groffen <grobian@gentoo.org>
Date: Sat, 19 Dec 2020 20:30:42 +0100
Subject: [PATCH] [cctools, cmake] as: fix compilation on powerpc-apple-darwin9

At least GCC (10.1.0) defines PPC by default on powerpc-apple-darwin9,
e.g. it would result in both I386 and PPC being defined, which is
resulting in compilation problems.  Undefine PPC to ensure only the
approprate target code is enabled.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
---
 cctools/as/CMakeLists.txt | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git cctools/as/CMakeLists.txt cctools/as/CMakeLists.txt
index 16d7b76..02734ff 100644
--- cctools/as/CMakeLists.txt
+++ cctools/as/CMakeLists.txt
@@ -42,13 +42,13 @@ if(XTOOLS_C_HAS_WNODEPRECATED_FLAG)
 endif()
 
 add_executable(as-driver driver.c)
-set_target_properties(as-driver PROPERTIES COMPILE_FLAGS "-Di486 -Di586 -Di686")
+set_target_properties(as-driver PROPERTIES COMPILE_FLAGS "-Di486 -Di586 -Di686 -UPPC")
 target_link_libraries(as-driver stuff)
 set_target_properties(as-driver PROPERTIES OUTPUT_NAME as)
 install(TARGETS as-driver DESTINATION bin )
 
 add_executable(i386-as ${X86_SRCS})
-set_target_properties(i386-as PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686")
+set_target_properties(i386-as PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686 -UPPC")
 set_target_properties(i386-as PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/i386)
 set_target_properties(i386-as PROPERTIES OUTPUT_NAME as)
 target_link_libraries(i386-as stuff)
@@ -59,13 +59,13 @@ install(TARGETS i386-as DESTINATION bin/i386)
 
 if(BUILD_TESTING)
   add_executable(test-x86 i386-check.c)
-  set_target_properties(test-x86 PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686")
+  set_target_properties(test-x86 PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686 -UPPC")
   set_target_properties(test-x86 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
   add_test(NAME check-x86-as COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/check-as $<TARGET_FILE:test-x86> i386 $<TARGET_FILE:as-driver>)
 endif()
 
 add_executable(x8664-as ${X86_SRCS})
-set_target_properties(x8664-as PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686 -DARCH64")
+set_target_properties(x8664-as PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686 -DARCH64 -UPPC")
 set_target_properties(x8664-as PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/x86_64)
 set_target_properties(x8664-as PROPERTIES OUTPUT_NAME as)
 target_link_libraries(x8664-as stuff)
@@ -76,7 +76,7 @@ install(TARGETS x8664-as DESTINATION bin/x86_64)
 
 if(BUILD_TESTING)
   add_executable(test-x86_64 i386-check.c)
-  set_target_properties(test-x86_64 PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686 -DARCH64")
+  set_target_properties(test-x86_64 PROPERTIES COMPILE_FLAGS "-DI386 -Di486 -Di586 -Di686 -DARCH64 -UPPC")
   set_target_properties(test-x86_64 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
   add_test(NAME check-x86_86-as COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/check-as $<TARGET_FILE:test-x86_64> x86_64 $<TARGET_FILE:as-driver>)
 endif()
@@ -109,7 +109,7 @@ endif()
 install(TARGETS ppc64-as DESTINATION bin/ppc64)
 
 add_executable(arm-as ${ARM_SRCS})
-set_target_properties(arm-as PROPERTIES COMPILE_FLAGS "-DARM")
+set_target_properties(arm-as PROPERTIES COMPILE_FLAGS "-DARM -UPPC")
 set_target_properties(arm-as PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/arm)
 set_target_properties(arm-as PROPERTIES OUTPUT_NAME as)
 target_link_libraries(arm-as stuff)
-- 
2.38.1

