diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -473,7 +473,7 @@ # Define an option controlling whether we should build for 32-bit on 64-bit # platforms, where supported. -if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) +if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT (WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")) # TODO: support other platforms and toolchains. option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) endif() diff --git a/llvm/cmake/modules/GetHostTriple.cmake b/llvm/cmake/modules/GetHostTriple.cmake --- a/llvm/cmake/modules/GetHostTriple.cmake +++ b/llvm/cmake/modules/GetHostTriple.cmake @@ -14,6 +14,13 @@ else() set( value "i686-pc-windows-gnu" ) endif() + elseif( CMAKE_HOST_SYSTEM_NAME STREQUAL AIX ) + # We defer to dynamic detection of the host AIX version. + if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + set( value "powerpc64-ibm-aix" ) + else() + set( value "powerpc-ibm-aix" ) + endif() else( MSVC ) if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS) message(WARNING "unable to determine host target triple") @@ -26,8 +33,7 @@ if( NOT TT_RV EQUAL 0 ) message(FATAL_ERROR "Failed to execute ${config_guess}") endif( NOT TT_RV EQUAL 0 ) - # Defer to dynamic detection of the host AIX version. - string(REGEX REPLACE "-aix[0-9][^-]*" "-aix" value ${TT_OUT}) + set( value ${TT_OUT} ) endif() endif( MSVC ) set( ${var} ${value} PARENT_SCOPE ) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -169,17 +169,6 @@ endif() if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") - if(NOT LLVM_BUILD_32_BITS) - if (CMAKE_CXX_COMPILER_ID MATCHES "XL") - append("-q64" CMAKE_CXX_FLAGS CMAKE_C_FLAGS) - else() - append("-maix64" CMAKE_CXX_FLAGS CMAKE_C_FLAGS) - endif() - set(CMAKE_CXX_ARCHIVE_CREATE " -X64 qc ") - set(CMAKE_CXX_ARCHIVE_APPEND " -X64 q ") - set(CMAKE_C_ARCHIVE_FINISH " -X64 ") - set(CMAKE_CXX_ARCHIVE_FINISH " -X64 ") - endif() # -fPIC does not enable the large code model for GCC on AIX but does for XL. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") append("-mcmodel=large" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)