[llvm] 9e0c955 - [AIX] Improve 32/64-bit build configuration
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 12:41:18 PST 2020
Author: David Tenty
Date: 2020-02-20T15:41:00-05:00
New Revision: 9e0c95572e5a245b79eff2b214d9b3580e703e4d
URL: https://github.com/llvm/llvm-project/commit/9e0c95572e5a245b79eff2b214d9b3580e703e4d
DIFF: https://github.com/llvm/llvm-project/commit/9e0c95572e5a245b79eff2b214d9b3580e703e4d.diff
LOG: [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
Added:
Modified:
llvm/CMakeLists.txt
llvm/cmake/modules/GetHostTriple.cmake
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 5133139d6ce3..781098d38916 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -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()
diff --git a/llvm/cmake/modules/GetHostTriple.cmake b/llvm/cmake/modules/GetHostTriple.cmake
index 6c15e2d48964..251ca1a32b14 100644
--- a/llvm/cmake/modules/GetHostTriple.cmake
+++ b/llvm/cmake/modules/GetHostTriple.cmake
@@ -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 )
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 29a914cf59af..4868a85a12a1 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -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)
More information about the llvm-commits
mailing list