[llvm] [z/OS] Improve compiler options on z/OS (PR #166415)
Kai Nacke via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 11:12:18 PST 2025
https://github.com/redstar created https://github.com/llvm/llvm-project/pull/166415
`_XPLATFORM_SOURCE` needs to be defined to improve source code compatibility (e.g. for `O_CLOEXEC`). The define `_UNIX03_THREADS` can be removed, because it is automatically set by `_XOPEN_SOURCE=600`.
See the documentation of feature test macros: https://www.ibm.com/docs/en/zos/3.1.0?topic=files-feature-test-macros
Tested on z/OS 3.1 with the Open XL C/C++ 2.2 compiler.
>From 973e25823c4db419a16f35aa53c7b139231bf286 Mon Sep 17 00:00:00 2001
From: Kai Nacke <kai.peter.nacke at ibm.com>
Date: Tue, 4 Nov 2025 14:09:11 -0500
Subject: [PATCH] [z/OS] Improve compiler options on z/OS
`_XPLATFORM_SOURCE` needs to be defined to improve source code compatibility (e.g. for `O_CLOEXEC`).
The define `_UNIX03_THREADS` can be removed, because it is automatically set by `_XOPEN_SOURCE=600`.
See the documentation of feature test macros: https://www.ibm.com/docs/en/zos/3.1.0?topic=files-feature-test-macros
Tested on z/OS 3.1 with the Open XL C/C++ 2.2 compiler.
---
llvm/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c450ee5a3d72e..f50b0d3c0d01b 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1264,10 +1264,10 @@ endif()
# Build with _XOPEN_SOURCE on z/OS.
if (CMAKE_SYSTEM_NAME MATCHES "OS390")
add_compile_definitions(_XOPEN_SOURCE=600)
+ add_compile_definitions(_XPLATFORM_SOURCE)
add_compile_definitions(_OPEN_SYS) # Needed for process information.
add_compile_definitions(_OPEN_SYS_FILE_EXT) # Needed for EBCDIC I/O.
add_compile_definitions(_EXT) # Needed for file data.
- add_compile_definitions(_UNIX03_THREADS) # Multithreading support.
# Need to build LLVM as ASCII application.
# This can't be a global setting because other projects may
# need to be built in EBCDIC mode.
More information about the llvm-commits
mailing list