Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/build-data/cc/clang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ macos -> "{cxx} -dynamiclib -fPIC -install_name {libdir}/{soname_abi} -c

# The default works for GNU ld and several other Unix linkers
default -> "{cxx} -shared -fPIC -Wl,-soname,{soname_abi}"
zos -> "{cxx} -shared -fPIC"

mingw -> "{cxx} -shared -Wl,--out-implib,{shared_lib_name}.a"
</so_link_commands>
Expand Down Expand Up @@ -105,11 +106,12 @@ llvm -> "-emit-llvm -fno-use-cxa-atexit"
</cpu_flags>

<mach_abi_linking>
all!haiku,llvm -> "-pthread"
all!haiku,llvm,zos -> "-pthread"

x86_32 -> "-m32"
x86_64 -> "-m64"
ppc64 -> "-m64"
zos -> "-fzos-le-char-mode=ascii -mnocsect -fno-short-enums -m64 -mzos-target=zosv3r1"

macos -> "-stdlib=libc++"
ios -> "-stdlib=libc++"
Expand Down
5 changes: 3 additions & 2 deletions src/build-data/cc/gcc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ macos -> "{cxx} -dynamiclib -fPIC -install_name {libdir}/{soname_abi}"
hpux -> "{cxx} -shared -fPIC -Wl,+h,{soname_abi}"
solaris -> "{cxx} -shared -fPIC -Wl,-h,{soname_abi}"

# AIX and OpenBSD don't use sonames at all
# These platforms don't use sonames at all
aix -> "{cxx} -shared -fPIC"
zos -> "{cxx} -shared -fPIC"
openbsd -> "{cxx} -shared -fPIC"

mingw -> "{cxx} -shared -Wl,--out-implib,{shared_lib_name}.a"
Expand Down Expand Up @@ -107,7 +108,7 @@ arm64:neon -> ""

# Flags set here are included at compile and link time
<mach_abi_linking>
all!haiku,qnx,none -> "-pthread"
all!haiku,qnx,zos,none -> "-pthread"

s390 -> "-m31"
s390x -> "-m64"
Expand Down
29 changes: 29 additions & 0 deletions src/build-data/os/zos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
soname_suffix "so"

use_stack_protector no

<feature_macros>
_XOPEN_SOURCE=600
_ALL_SOURCE
_OPEN_SYS_FILE_EXT=1
_AE_BIMODAL=1
_ENHANCED_ASCII_EXT=0xFFFFFFFF
</feature_macros>

<target_features>
posix1
clock_gettime
dev_random
Comment thread
IgorTodorovskiIBM marked this conversation as resolved.

atomics
sockets
system_clock
threads
filesystem
</target_features>

<aliases>
z/OS
os/390
os390
</aliases>
Comment thread
IgorTodorovskiIBM marked this conversation as resolved.
10 changes: 8 additions & 2 deletions src/lib/ffi/ffi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ namespace Botan_FFI {

namespace {

// NOLINTNEXTLINE(*-avoid-non-const-global-variables)
thread_local std::string g_last_exception_what;

#if defined(BOTAN_TARGET_OS_HAS_THREAD_LOCAL)
// NOLINTNEXTLINE(*-avoid-non-const-global-variables)
thread_local std::string g_last_exception_what;
#else
// NOLINTNEXTLINE(*-avoid-non-const-global-variables)
std::string g_last_exception_what;
#endif

int ffi_map_error_type(Botan::ErrorType err) {
switch(err) {
Expand Down
8 changes: 8 additions & 0 deletions src/lib/utils/os_utils/os_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
#include <kernel/OS.h>
#endif

#if defined(BOTAN_TARGET_OS_IS_ZOS)
#include <builtins.h>
#endif

namespace Botan {

uint32_t OS::get_process_id() {
Expand Down Expand Up @@ -220,7 +224,11 @@ uint64_t OS::get_cpu_cycle_counter() {
asm volatile("mov %0=ar.itc" : "=r"(rtc));

#elif defined(BOTAN_TARGET_ARCH_IS_S390X)
#if defined(BOTAN_TARGET_OS_IS_ZOS)
__stckf(&rtc);
#else
asm volatile("stck 0(%0)" : : "a"(&rtc) : "memory", "cc");
#endif

#elif defined(BOTAN_TARGET_ARCH_IS_HPPA)
asm volatile("mfctl 16,%0" : "=r"(rtc)); // 64-bit only?
Expand Down
Loading