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

[SystemZ/ZOS] Additions to the build system.

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

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D83866
This commit is contained in:
Kai Nacke 2020-07-09 14:17:33 +02:00 committed by Kai Nacke
parent 5ff99f6b0a
commit 25dee07590
4 changed files with 25 additions and 6 deletions

View File

@ -354,7 +354,12 @@ option(LLVM_ENABLE_LIBEDIT "Use libedit if available." ON)
option(LLVM_ENABLE_LIBPFM "Use libpfm for performance counters if available." ON)
# On z/OS, threads cannot be used because TLS is not supported.
if (CMAKE_SYSTEM_NAME MATCHES "OS390")
option(LLVM_ENABLE_THREADS "Use threads if available." OFF)
else()
option(LLVM_ENABLE_THREADS "Use threads if available." ON)
endif()
set(LLVM_ENABLE_ZLIB "ON" CACHE STRING "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON")
@ -932,6 +937,13 @@ if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -shared")
endif()
# Build with _XOPEN_SOURCE on z/OS.
if (CMAKE_SYSTEM_NAME MATCHES "OS390")
add_definitions("-D_XOPEN_SOURCE=600")
add_definitions("-D_OPEN_SYS") # Needed for process information.
add_definitions("-D_OPEN_SYS_FILE_EXT") # Needed for EBCDIC I/O.
endif()
# Build with _FILE_OFFSET_BITS=64 on Solaris to match g++ >= 9.
if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
add_definitions("-D_FILE_OFFSET_BITS=64")
@ -942,7 +954,7 @@ endif()
# check its symbols. This is wasteful (the check was done when foo.so
# was created) and can fail since it is not the dynamic linker and
# doesn't know how to handle search paths correctly.
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS|AIX")
if (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS|AIX|OS390")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
endif()

View File

@ -221,7 +221,7 @@ function(add_link_opts target_name)
# Pass -O3 to the linker. This enabled different optimizations on different
# linkers.
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|SunOS|AIX" OR WIN32))
if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|SunOS|AIX|OS390" OR WIN32))
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-O3")
endif()
@ -249,11 +249,12 @@ function(add_link_opts target_name)
LINK_FLAGS " -Wl,-z,discard-unused=sections")
endif()
elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD AND
NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD|AIX")
NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD|AIX|OS390")
# Object files are compiled with -ffunction-data-sections.
# Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks
# tools that use plugins. Always pass --gc-sections once we require
# a newer linker.
# TODO Revisit this later on z/OS.
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,--gc-sections")
endif()

View File

@ -14,7 +14,9 @@ function( get_host_triple var )
else()
set( value "i686-pc-windows-gnu" )
endif()
elseif( CMAKE_HOST_SYSTEM_NAME STREQUAL AIX )
elseif( CMAKE_SYSTEM_NAME MATCHES "OS390" )
set( value "s390x-ibm-zos" )
elseif( CMAKE_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" )

View File

@ -144,6 +144,10 @@ else(WIN32)
endif(FUCHSIA OR UNIX)
endif(WIN32)
if (CMAKE_SYSTEM_NAME MATCHES "OS390")
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
endif()
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
@ -207,7 +211,7 @@ endif()
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
# build might work on ELF but fail on MachO/COFF.
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS" OR
if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS|OS390" OR
WIN32 OR CYGWIN) AND
NOT LLVM_USE_SANITIZER)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")