Skip to content

Commit 6db3e61

Browse files
committed
Use wrapper to get for strnlen/strsignal
1 parent 0364baf commit 6db3e61

File tree

17 files changed

+83
-59
lines changed

17 files changed

+83
-59
lines changed

clang/lib/AST/ByteCode/Context.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "clang/AST/ASTLambda.h"
2222
#include "clang/AST/Expr.h"
2323
#include "clang/Basic/TargetInfo.h"
24-
#include "llvm/Support/SystemZ/zOSSupport.h"
2524

2625
using namespace clang;
2726
using namespace clang::interp;

llvm/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,11 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
12941294
# (this is a variable that CrossCompile sets on recursive invocations)
12951295
endif()
12961296

1297+
# Special hack for z/OS for missing POSIX functions
1298+
if (CMAKE_SYSTEM_NAME MATCHES "OS390")
1299+
include_directories(SYSTEM "${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/SystemZ/zos_wrappers" )
1300+
endif()
1301+
12971302
if( "${CMAKE_SYSTEM_NAME}" MATCHES SunOS )
12981303
# special hack for Solaris to handle crazy system sys/regset.h
12991304
include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")

llvm/include/llvm/Support/SystemZ/zOSSupport.h

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//===- string.h - Common z/OS Include File ----------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file declares z/OS implementations for common functions.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_SUPPORT_ZOSWRAPPER_STRING_H
14+
#define LLVM_SUPPORT_ZOSWRAPPER_STRING_H
15+
16+
#include_next <string.h>
17+
18+
#ifdef __cplusplus
19+
extern "C" {
20+
#endif
21+
22+
// z/OS Unix System Services does not have support for:
23+
// - strsignal()
24+
// - strnlen()
25+
// Implementations are provided for z/OS.
26+
27+
char *strsignal(int sig) asm("llvm_zos_strsignal");
28+
29+
size_t strnlen(const char *S, size_t MaxLen) asm("llvm_zos_strnlen");
30+
31+
#ifdef __cplusplus
32+
}
33+
#endif
34+
35+
#endif

llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "llvm/Support/Alignment.h"
1111
#include "llvm/Support/Errc.h"
1212
#include "llvm/Support/ErrorHandling.h"
13-
#include "llvm/Support/SystemZ/zOSSupport.h"
1413

1514
using namespace llvm;
1615
using namespace llvm::objcopy::macho;

llvm/lib/ObjCopy/MachO/MachOObject.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "MachOObject.h"
1010
#include "llvm/ADT/SmallPtrSet.h"
11-
#include "llvm/Support/SystemZ/zOSSupport.h"
1211
#include <unordered_set>
1312

1413
using namespace llvm;

llvm/lib/ObjCopy/MachO/MachOReader.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "MachOObject.h"
1111
#include "llvm/BinaryFormat/MachO.h"
1212
#include "llvm/Object/MachO.h"
13-
#include "llvm/Support/SystemZ/zOSSupport.h"
1413
#include <memory>
1514

1615
using namespace llvm;

llvm/lib/ObjectYAML/MachOEmitter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "llvm/Support/FormatVariadic.h"
2121
#include "llvm/Support/LEB128.h"
2222
#include "llvm/Support/YAMLTraits.h"
23-
#include "llvm/Support/SystemZ/zOSSupport.h"
2423
#include "llvm/Support/raw_ostream.h"
2524

2625
using namespace llvm;

llvm/lib/ObjectYAML/MachOYAML.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "llvm/BinaryFormat/MachO.h"
1616
#include "llvm/Support/YAMLTraits.h"
1717
#include "llvm/Support/raw_ostream.h"
18-
#include "llvm/Support/SystemZ/zOSSupport.h"
1918
#include "llvm/TargetParser/Host.h"
2019
#include <cstdint>
2120
#include <cstring>

llvm/lib/Support/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ if(LLVM_INTEGRATED_CRT_ALLOC)
125125
endif()
126126
endif()
127127

128+
#if (CMAKE_SYSTEM_NAME MATCHES "OS390")
129+
set(ZOSLIB_FILES "zOSLibFunctions.cpp")
130+
#endif()
131+
128132
# FIXME: We are currently guarding AIX headers with _XOPEN_SOURCE=700.
129133
# See llvm/CMakeLists.txt. However, we need _SC_NPROCESSORS_ONLN in
130134
# unistd.h and it is guarded by _ALL_SOURCE, so we remove the _XOPEN_SOURCE
@@ -294,6 +298,8 @@ add_llvm_component_library(LLVMSupport
294298
xxhash.cpp
295299
Z3Solver.cpp
296300

301+
${ZOSLIB_FILES}
302+
297303
${ALLOCATOR_FILES}
298304
$<TARGET_OBJECTS:LLVMSupportBlake3>
299305

0 commit comments

Comments
 (0)