[llvm] [SystemZ/ZOS] Additions to the build system. (PR #74730)

Abhina Sree via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 08:14:45 PST 2023


https://github.com/abhina-sree created https://github.com/llvm/llvm-project/pull/74730

This change extend the CMake files with the necessary additions to build LLVM for z/OS.

>From 768e27f0da74f3ba93f9869218029a418264e895 Mon Sep 17 00:00:00 2001
From: Abhina Sreeskantharajan <Abhina.Sreeskantharajan at ibm.com>
Date: Thu, 7 Dec 2023 11:11:08 -0500
Subject: [PATCH 1/2] This change extend the CMake files with the necessary
 additions to build LLVM for z/OS.

---
 llvm/CMakeLists.txt                       | 4 +++-
 llvm/cmake/modules/GetHostTriple.cmake    | 2 ++
 llvm/lib/Transforms/Hello/CMakeLists.txt  | 2 +-
 llvm/tools/bugpoint-passes/CMakeLists.txt | 2 +-
 llvm/tools/llvm-shlib/CMakeLists.txt      | 3 +++
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 1c983165b2ef0..1d8f5f41434aa 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -581,7 +581,9 @@ set(LLVM_TARGETS_TO_BUILD
    ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
 list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
 
-option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
+if (NOT ZOS)
+  option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
+endif()
 option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." ON)
diff --git a/llvm/cmake/modules/GetHostTriple.cmake b/llvm/cmake/modules/GetHostTriple.cmake
index 1be13bc01ab9b..d35cf82fe9fe6 100644
--- a/llvm/cmake/modules/GetHostTriple.cmake
+++ b/llvm/cmake/modules/GetHostTriple.cmake
@@ -41,6 +41,8 @@ function( get_host_triple var )
     else()
       set( value "powerpc-ibm-aix" )
     endif()
+  elseif( ZOS )
+    set( value "s390x-ibm-zos" )
   else( MSVC )
     if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
       message(WARNING "unable to determine host target triple")
diff --git a/llvm/lib/Transforms/Hello/CMakeLists.txt b/llvm/lib/Transforms/Hello/CMakeLists.txt
index c4f10247c1a6c..9510c31f633fe 100644
--- a/llvm/lib/Transforms/Hello/CMakeLists.txt
+++ b/llvm/lib/Transforms/Hello/CMakeLists.txt
@@ -6,7 +6,7 @@ if( NOT LLVM_REQUIRES_RTTI )
   endif()
 endif()
 
-if(WIN32 OR CYGWIN)
+if(WIN32 OR CYGWIN OR ZOS)
   set(LLVM_LINK_COMPONENTS Core Support)
 endif()
 
diff --git a/llvm/tools/bugpoint-passes/CMakeLists.txt b/llvm/tools/bugpoint-passes/CMakeLists.txt
index 6df49d7abd880..60fc1bde51371 100644
--- a/llvm/tools/bugpoint-passes/CMakeLists.txt
+++ b/llvm/tools/bugpoint-passes/CMakeLists.txt
@@ -10,7 +10,7 @@ if( NOT LLVM_REQUIRES_RTTI )
   endif()
 endif()
 
-if(WIN32 OR CYGWIN)
+if(WIN32 OR CYGWIN OR ZOS)
   set(LLVM_LINK_COMPONENTS Core Support)
 endif()
 
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index 8ace190b28f74..5079316533d37 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -14,6 +14,9 @@ if(LLVM_BUILD_LLVM_DYLIB)
   if(MSVC)
     message(FATAL_ERROR "Generating libLLVM is not supported on MSVC")
   endif()
+  if(ZOS)
+    message(FATAL_ERROR "Generating libLLVM is not supported on z/OS")
+  endif()
 
   llvm_map_components_to_libnames(LIB_NAMES ${LLVM_DYLIB_COMPONENTS})
 

>From cda6bca1227031714a3f9ea371be0715e6d2fde4 Mon Sep 17 00:00:00 2001
From: Abhina Sreeskantharajan <Abhina.Sreeskantharajan at ibm.com>
Date: Thu, 7 Dec 2023 11:13:22 -0500
Subject: [PATCH 2/2] remove duplicate code

---
 llvm/cmake/modules/GetHostTriple.cmake | 2 --
 1 file changed, 2 deletions(-)

diff --git a/llvm/cmake/modules/GetHostTriple.cmake b/llvm/cmake/modules/GetHostTriple.cmake
index d35cf82fe9fe6..1be13bc01ab9b 100644
--- a/llvm/cmake/modules/GetHostTriple.cmake
+++ b/llvm/cmake/modules/GetHostTriple.cmake
@@ -41,8 +41,6 @@ function( get_host_triple var )
     else()
       set( value "powerpc-ibm-aix" )
     endif()
-  elseif( ZOS )
-    set( value "s390x-ibm-zos" )
   else( MSVC )
     if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
       message(WARNING "unable to determine host target triple")



More information about the llvm-commits mailing list