[PATCH] D74256: [AIX] Improve 32/64-bit build configuration

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 08:23:36 PST 2020


daltenty updated this revision to Diff 244680.
daltenty edited the summary of this revision.
daltenty added a comment.

- Don't present the LLVM_BUILD_32_BITS option on AIX


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74256/new/

https://reviews.llvm.org/D74256

Files:
  llvm/CMakeLists.txt
  llvm/cmake/modules/GetHostTriple.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -161,17 +161,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 "<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)
Index: llvm/cmake/modules/GetHostTriple.cmake
===================================================================
--- llvm/cmake/modules/GetHostTriple.cmake
+++ 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 )
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ 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()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74256.244680.patch
Type: text/x-patch
Size: 2599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200214/5b758f1b/attachment.bin>


More information about the llvm-commits mailing list