Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 0 additions & 1 deletion clang/lib/AST/ByteCode/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Expr.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/Support/SystemZ/zOSSupport.h"

using namespace clang;
using namespace clang::interp;
Expand Down
5 changes: 5 additions & 0 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,11 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
# (this is a variable that CrossCompile sets on recursive invocations)
endif()

# Special hack for z/OS for missing POSIX functions
if (CMAKE_SYSTEM_NAME MATCHES "OS390")
include_directories(SYSTEM "${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/SystemZ/zos_wrappers" )
endif()

if( "${CMAKE_SYSTEM_NAME}" MATCHES SunOS )
# special hack for Solaris to handle crazy system sys/regset.h
include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")
Expand Down
47 changes: 0 additions & 47 deletions llvm/include/llvm/Support/SystemZ/zOSSupport.h

This file was deleted.

35 changes: 35 additions & 0 deletions llvm/include/llvm/Support/SystemZ/zos_wrappers/string.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//===- string.h - Common z/OS Include File ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares z/OS implementations for common functions.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_ZOSWRAPPER_STRING_H
#define LLVM_SUPPORT_ZOSWRAPPER_STRING_H

#include_next <string.h>

#ifdef __cplusplus
extern "C" {
#endif

// z/OS Unix System Services does not have support for:
// - strsignal()
// - strnlen()
// Implementations are provided for z/OS.

char *strsignal(int sig) asm("llvm_zos_strsignal");

size_t strnlen(const char *S, size_t MaxLen) asm("llvm_zos_strnlen");

#ifdef __cplusplus
}
#endif

#endif
1 change: 0 additions & 1 deletion llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SystemZ/zOSSupport.h"

using namespace llvm;
using namespace llvm::objcopy::macho;
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/ObjCopy/MachO/MachOObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "MachOObject.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include <unordered_set>

using namespace llvm;
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/ObjCopy/MachO/MachOReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "MachOObject.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include <memory>

using namespace llvm;
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/ObjectYAML/MachOEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include "llvm/Support/raw_ostream.h"

using namespace llvm;
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/ObjectYAML/MachOYAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include "llvm/TargetParser/Host.h"
#include <cstdint>
#include <cstring>
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ add_llvm_component_library(LLVMSupport
Threading.cpp
Valgrind.cpp
Watchdog.cpp
zOSLibFunctions.cpp

ADDITIONAL_HEADER_DIRS
Unix
Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/Support/Unix/Program.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include "llvm/Support/raw_ostream.h"
#include <sys/stat.h>
#include <sys/resource.h>
#include <signal.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/resource.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
Expand Down
82 changes: 82 additions & 0 deletions llvm/lib/Support/zOSLibFunctions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//===-- zOSLibFunctions.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
//
// This file defines z/OS implementations for common functions.
//
//===----------------------------------------------------------------------===//

#ifdef __MVS__
#include <stdio.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/wait.h>

const char *signalName[] = {
/* 0 */ nullptr,
/* 1 */ "Hangup", // SIGHUP
/* 2 */ "Interrupt", // SIGINT
/* 3 */ "Aborted", // SIGABRT
/* 4 */ "Illegal instruction", // SIGILL
/* 5 */ "Polling event", // SIGPOLL
/* 6 */ "Socket data available", // SIGURG
/* 7 */ "Stopped (signal)", // SIGSTOP
/* 8 */ "Floating point exception", // SIGFPE
/* 9 */ "Killed", // SIGKILL
/* 10 */ "Bus error", // SIGBUS
/* 11 */ "Segmentation fault", // SIGSEGV
/* 12 */ "Bad system call", // SIGSYS
/* 13 */ "Broken pipe", // SIGPIPE
/* 14 */ "Alarm clock", // SIGALRM
/* 15 */ "Terminated", // SIGTERM
/* 16 */ "User defined signal 1", // SIGUSR1
/* 17 */ "User defined signal 2", // SIGUSR2
/* 18 */ "Abend", // SIGABND
/* 19 */ "Continued", // SIGCONT
/* 20 */ "Child exited", // SIGCHLD
/* 21 */ "Stopped (tty input)", // SIGTTIN
/* 22 */ "Stopped (tty output)", // SIGTTOU
/* 23 */ "I/O complete", // SIGIO
/* 24 */ "Quit", // SIGQUIT
/* 25 */ "Stopped", // SIGTSTP
/* 26 */ "Trace/breakpoint trap", // SIGTRAP
/* 27 */ "I/O error", // SIGIOERR
/* 28 */ "Window changed", // SIGWINCH
/* 29 */ "CPU time limit exceeded", // SIGXCPU
/* 30 */ "File size limit exceeded", // SIGXFSZ
/* 31 */ "Virtual timer expired", // SIGVTALRM
/* 32 */ "Profiling timer expired", // SIGPROF
/* 33 */ "OMVS subsystem shutdown", // SIGDANGER
/* 34 */ "Thread stop", // SIGTHSTOP
/* 35 */ "Thread resume", // SIGTHCONT
/* 36 */ nullptr, // n/a
/* 37 */ "Toggle syscall trace", // SIGTRACE
/* 38 */ nullptr, // SIGDCE
/* 39 */ "System dump", // SIGDUMP
};

// z/OS Unix System Services does not have strsignal() support, so the
// strsignal() function is implemented here.
char *strsignal(int sig) {
if (static_cast<size_t>(sig) < (sizeof(signalName) / sizeof(signalName[0])) &&
signalName[sig])
return const_cast<char *>(signalName[sig]);
static char msg[256];
sprintf(msg, "Unknown signal %d", sig);
return msg;
}

// z/OS Unix System Services does not have strnlen() support, so the strnlen()
// function is implemented here.
size_t strnlen(const char *S, size_t MaxLen) {
const char *PtrToNullChar =
static_cast<const char *>(memchr(S, '\0', MaxLen));
return PtrToNullChar ? PtrToNullChar - S : MaxLen;
}
#endif
1 change: 0 additions & 1 deletion llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include <cmath>
#include <memory>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion llvm/tools/llvm-exegesis/lib/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX

#ifdef LLVM_ON_UNIX
#include "llvm/Support/SystemZ/zOSSupport.h"
#include <string.h>
#endif // LLVM_ON_UNIX

Expand Down
1 change: 0 additions & 1 deletion llvm/tools/llvm-readobj/ELFDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#include "llvm/Support/RISCVAttributeParser.h"
#include "llvm/Support/RISCVAttributes.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <array>
Expand Down
1 change: 0 additions & 1 deletion llvm/tools/llvm-readobj/ObjDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/SystemZ/zOSSupport.h"
#include "llvm/Support/raw_ostream.h"
#include <map>

Expand Down
1 change: 0 additions & 1 deletion llvm/tools/obj2yaml/macho2yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/SystemZ/zOSSupport.h"

#include <string.h> // for memcpy

Expand Down
Loading