1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[AIX] Improve 32/64-bit build configuration

Summary:
AIX supports both 32-bit and 64-bit environments (with 32-bit being the default). This patch improves support for building LLVM on AIX in both 32-bit and 64-bit mode.

  - Change host detection to return correct 32/64-bit triple as config_guess does not return the correct version on 64-bit. This can confuse JIT tests and other things that care about what the host triple is.
  - Remove manual setting of 64-bit flags on AIX. AIX provides OBJECT_MODE environment variable to enable the user to obtain a 64-bit development environment. CMake will properly set these flags provided the user sets the correct OBJECT_MODE before configuring and setting them manually will interfere with 32-bit builds.
  - Don't present the LLVM_BUILD_32_BITS option on AIX, users should use OBJECT_MODE when running CMake instead.

Reviewers: hubert.reinterpretcast, DiggerLin, stevewan

Reviewed By: DiggerLin, stevewan

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74256
This commit is contained in:
David Tenty 2020-02-20 15:39:16 -05:00
parent c62fbc0139
commit 94bdd8542e
3 changed files with 9 additions and 14 deletions

View File

@ -473,7 +473,7 @@ option(LLVM_USE_SPLIT_DWARF
# 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()

View File

@ -14,6 +14,13 @@ function( get_host_triple var )
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 @@ function( get_host_triple var )
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 )

View File

@ -169,17 +169,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
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 "<CMAKE_AR> -X64 qc <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> -X64 q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -X64 <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -X64 <TARGET>")
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)