Index: llvm/CMakeLists.txt =================================================================== --- llvm/CMakeLists.txt +++ llvm/CMakeLists.txt @@ -703,8 +703,15 @@ include(config-ix) # By default, we target the host, but this can be overridden at CMake -# invocation time. -set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING +# invocation time. Except on 64-bit AIX, where the system toolchain +# expect 32-bit objects by default. +if("${LLVM_HOST_TRIPLE}" MATCHES "^powerpc64-ibm-aix") + string(REGEX REPLACE "^powerpc64" "powerpc" LLVM_DEFAULT_TARGET_TRIPLE_default "${LLVM_HOST_TRIPLE}") +else() + set(LLVM_DEFAULT_TARGET_TRIPLE_default "${LLVM_HOST_TRIPLE}") +endif() + +set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE_default}" CACHE STRING "Default target for which LLVM will generate code." ) set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")