Merge remote-tracking branch 'origin/8' into snapshot

This commit is contained in:
Sylvestre Ledru 2019-02-09 17:43:04 +01:00
commit 04af4f72a6
24 changed files with 1592 additions and 3 deletions

View File

@ -0,0 +1,74 @@
r345104 | rnk | 2018-10-24 01:35:43 +0200 (mer. 24 oct. 2018) | 25 lignes
[hurd] Make getMainExecutable get the real binary path
On GNU/Hurd, llvm-config is returning bogus value, such as:
$ llvm-config-6.0 --includedir
/usr/include
while it should be:
$ llvm-config-6.0 --includedir
/usr/lib/llvm-6.0/include
This is because getMainExecutable does not get the actual installation
path. On GNU/Hurd, /proc/self/exe is indeed a symlink to the path that
was used to start the program, and not the eventual binary file. Llvm's
getMainExecutable thus needs to run realpath over it to get the actual
place where llvm was installed (/usr/lib/llvm-6.0/bin/llvm-config), and
not /usr/bin/llvm-config-6.0. This will not change the result on Linux,
where /proc/self/exe already points to the eventual file.
Patch by Samuel Thibault!
While making changes here, I reformatted this block a bit to reduce
indentation and match 2 space indent style.
Differential Revision: https://reviews.llvm.org/D53557
Index: llvm-toolchain-6.0-6.0.1/lib/Support/Unix/Path.inc
===================================================================
--- llvm-toolchain-6.0-6.0.1.orig/lib/Support/Unix/Path.inc
+++ llvm-toolchain-6.0-6.0.1/lib/Support/Unix/Path.inc
@@ -191,14 +191,34 @@ std::string getMainExecutable(const char
char exe_path[MAXPATHLEN];
StringRef aPath("/proc/self/exe");
if (sys::fs::exists(aPath)) {
- // /proc is not always mounted under Linux (chroot for example).
- ssize_t len = readlink(aPath.str().c_str(), exe_path, sizeof(exe_path));
- if (len >= 0)
- return std::string(exe_path, len);
+ // /proc is not always mounted under Linux (chroot for example).
+ ssize_t len = readlink(aPath.str().c_str(), exe_path, sizeof(exe_path));
+ if (len < 0)
+ return "";
+
+ // Null terminate the string for realpath. readlink never null
+ // terminates its output.
+ len = std::min(len, ssize_t(sizeof(exe_path) - 1));
+ exe_path[len] = '\0';
+
+ // At least on GNU/Hurd, /proc/self/exe is a symlink to the path that
+ // was used to start the program, and not the eventual binary file.
+ // We thus needs to run realpath over it to get the actual place
+ // where llvm was installed.
+#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
+ char *real_path = realpath(exe_path, NULL);
+ std::string ret = std::string(real_path);
+ free(real_path);
+ return ret;
+#else
+ char real_path[MAXPATHLEN];
+ realpath(exe_path, real_path);
+ return std::string(real_path);
+#endif
} else {
- // Fall back to the classical detection.
- if (getprogpath(exe_path, argv0))
- return exe_path;
+ // Fall back to the classical detection.
+ if (getprogpath(exe_path, argv0))
+ return exe_path;
}
#elif defined(HAVE_DLFCN_H) && defined(HAVE_DLADDR)
// Use dladdr to get executable path if available.

View File

@ -0,0 +1,150 @@
r346310 | achurbanov | 2018-11-07 13:27:38 +0100 (Wed, 07 Nov 2018) | 6 lines
Add Hurd support.
Patch by samuel.thibault@ens-lyon.org
Differential Revision: https://reviews.llvm.org/D54079
Index: llvm/openmp/runtime/src/kmp.h
===================================================================
--- llvm/openmp/runtime/src/kmp.h.orig
+++ llvm/openmp/runtime/src/kmp.h
@@ -1048,6 +1048,10 @@ extern kmp_uint64 __kmp_now_nsec();
/* TODO: tune for KMP_OS_NETBSD */
#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */
#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */
+#elif KMP_OS_HURD
+/* TODO: tune for KMP_OS_HURD */
+#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */
+#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */
#endif
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
Index: llvm/openmp/runtime/src/kmp_ftn_entry.h
===================================================================
--- llvm/openmp/runtime/src/kmp_ftn_entry.h.orig
+++ llvm/openmp/runtime/src/kmp_ftn_entry.h
@@ -369,7 +369,7 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_
#else
int gtid;
-#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD
+#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_HURD
gtid = __kmp_entry_gtid();
#elif KMP_OS_WINDOWS
if (!__kmp_init_parallel ||
Index: llvm/openmp/runtime/src/kmp_platform.h
===================================================================
--- llvm/openmp/runtime/src/kmp_platform.h.orig
+++ llvm/openmp/runtime/src/kmp_platform.h
@@ -22,6 +22,7 @@
#define KMP_OS_DARWIN 0
#define KMP_OS_WINDOWS 0
#define KMP_OS_CNK 0
+#define KMP_OS_HURD 0
#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
#ifdef _WIN32
@@ -59,13 +60,18 @@
#define KMP_OS_CNK 1
#endif
+#if (defined __GNU__)
+#undef KMP_OS_HURD
+#define KMP_OS_HURD 1
+#endif
+
#if (1 != \
KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_DARWIN + \
- KMP_OS_WINDOWS)
+ KMP_OS_WINDOWS + KMP_OS_HURD)
#error Unknown OS
#endif
-#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN || KMP_OS_HURD
#undef KMP_OS_UNIX
#define KMP_OS_UNIX 1
#endif
Index: llvm/openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- llvm/openmp/runtime/src/kmp_runtime.cpp.orig
+++ llvm/openmp/runtime/src/kmp_runtime.cpp
@@ -7643,7 +7643,7 @@ __kmp_determine_reduction_method(
#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || \
- KMP_OS_DARWIN
+ KMP_OS_DARWIN || KMP_OS_HURD
int teamsize_cutoff = 4;
@@ -7670,7 +7670,7 @@ __kmp_determine_reduction_method(
#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS
-#if KMP_OS_LINUX || KMP_OS_WINDOWS
+#if KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_HURD
// basic tuning
Index: llvm/openmp/runtime/src/thirdparty/ittnotify/ittnotify_static.c
===================================================================
--- llvm/openmp/runtime/src/thirdparty/ittnotify/ittnotify_static.c.orig
+++ llvm/openmp/runtime/src/thirdparty/ittnotify/ittnotify_static.c
@@ -70,6 +70,10 @@ static const char* ittnotify_lib_name =
#define ANDROID_ITTNOTIFY_DEFAULT_PATH "/data/data/com.intel.vtune/intel/libittnotify.so"
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
#ifndef LIB_VAR_NAME
#if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_MIPS
Index: llvm/openmp/runtime/src/z_Linux_util.cpp
===================================================================
--- llvm/openmp/runtime/src/z_Linux_util.cpp.orig
+++ llvm/openmp/runtime/src/z_Linux_util.cpp
@@ -444,8 +444,7 @@ void __kmp_terminate_thread(int gtid) {
determined exactly, FALSE if incremental refinement is necessary. */
static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) {
int stack_data;
-#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD
- /* Linux* OS only -- no pthread_getattr_np support on OS X* */
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_HURD
pthread_attr_t attr;
int status;
size_t size = 0;
@@ -497,7 +496,7 @@ static void *__kmp_launch_worker(void *t
sigset_t new_set, old_set;
#endif /* KMP_BLOCK_SIGNALS */
void *exit_val;
-#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_HURD
void *volatile padding = 0;
#endif
int gtid;
@@ -1765,7 +1764,7 @@ static int __kmp_get_xproc(void) {
int r = 0;
-#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_HURD
r = sysconf(_SC_NPROCESSORS_ONLN);
@@ -1953,9 +1952,9 @@ int __kmp_is_address_mapped(void *addr)
int found = 0;
int rc;
-#if KMP_OS_LINUX || KMP_OS_FREEBSD
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_HURD
- /* On Linux* OS, read the /proc/<pid>/maps pseudo-file to get all the address
+ /* On GNUish OSes, read the /proc/<pid>/maps pseudo-file to get all the address
ranges mapped into the address space. */
char *name = __kmp_str_format("/proc/%d/maps", getpid());

View File

@ -0,0 +1,24 @@
r346763 | ldionne | 2018-11-13 18:00:04 +0100 (Tue, 13 Nov 2018) | 5 lines
[libcxx] GNU/Hurd uses BSD-based interfaces, but does not (and won't) provide <sys/sysctl.h>
Reviewed as https://reviews.llvm.org/D54338.
Thanks to sthibaul for the patch.
Index: llvm-toolchain-7-7/libcxx/src/thread.cpp
===================================================================
--- llvm-toolchain-7-7.orig/libcxx/src/thread.cpp
+++ llvm-toolchain-7-7/libcxx/src/thread.cpp
@@ -19,9 +19,9 @@
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
# include <sys/param.h>
-# if defined(BSD)
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
# include <sys/sysctl.h>
-# endif // defined(BSD)
+# endif
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__)

View File

@ -0,0 +1,21 @@
r347347 | ldionne | 2018-11-20 22:14:05 +0100 (mar. 20 nov. 2018) | 6 lignes
[libcxx] Fix threads detection on GNU/Hurd
GNU/Hurd provides standard Posix threads
Reviewed as https://reviews.llvm.org/D54339.
Thanks to Samuel Thibault for the patch.
Index: llvm-toolchain-7-7/libcxx/include/__config
===================================================================
--- llvm-toolchain-7-7.orig/libcxx/include/__config
+++ llvm-toolchain-7-7/libcxx/include/__config
@@ -1110,6 +1110,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
defined(__Fuchsia__) || \
defined(__NetBSD__) || \
defined(__linux__) || \
+ defined(__GNU__) || \
defined(__APPLE__) || \
defined(__CloudABI__) || \
defined(__sun__) || \

View File

@ -0,0 +1,74 @@
Add Hurd triplet to LLVMSupport
This introduces GNU Hurd as a new target OS.
https://reviews.llvm.org/D54378
Index: llvm-toolchain-7-7.0.1~+rc2/include/llvm/ADT/Triple.h
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/include/llvm/ADT/Triple.h
+++ llvm-toolchain-7-7.0.1~+rc2/include/llvm/ADT/Triple.h
@@ -182,7 +182,8 @@ public:
Mesa3D,
Contiki,
AMDPAL, // AMD PAL Runtime
- LastOSType = AMDPAL
+ Hurd, // GNU/Hurd
+ LastOSType = Hurd
};
enum EnvironmentType {
UnknownEnvironment,
@@ -578,9 +579,15 @@ public:
return getOS() == Triple::KFreeBSD;
}
+ /// Tests whether the OS is Hurd.
+ bool isOSHurd() const {
+ return getOS() == Triple::Hurd;
+ }
+
/// Tests whether the OS uses glibc.
bool isOSGlibc() const {
- return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD) &&
+ return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
+ getOS() == Triple::Hurd) &&
!isAndroid();
}
Index: llvm-toolchain-7-7.0.1~+rc2/lib/Support/Triple.cpp
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/lib/Support/Triple.cpp
+++ llvm-toolchain-7-7.0.1~+rc2/lib/Support/Triple.cpp
@@ -209,6 +209,7 @@ StringRef Triple::getOSTypeName(OSType K
case Mesa3D: return "mesa3d";
case Contiki: return "contiki";
case AMDPAL: return "amdpal";
+ case Hurd: return "hurd";
}
llvm_unreachable("Invalid OSType");
@@ -502,6 +503,7 @@ static Triple::OSType parseOS(StringRef
.StartsWith("mesa3d", Triple::Mesa3D)
.StartsWith("contiki", Triple::Contiki)
.StartsWith("amdpal", Triple::AMDPAL)
+ .StartsWith("hurd", Triple::Hurd)
.Default(Triple::UnknownOS);
}
Index: llvm/unittests/ADT/TripleTest.cpp
===================================================================
--- llvm/unittests/ADT/TripleTest.cpp (révision 346226)
+++ llvm/unittests/ADT/TripleTest.cpp (copie de travail)
@@ -93,6 +93,12 @@
EXPECT_EQ(Triple::Contiki, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ T = Triple("i386-pc-hurd-gnu");
+ EXPECT_EQ(Triple::x86, T.getArch());
+ EXPECT_EQ(Triple::PC, T.getVendor());
+ EXPECT_EQ(Triple::Hurd, T.getOS());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
+
T = Triple("x86_64-pc-linux-gnu");
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::PC, T.getVendor());

View File

@ -0,0 +1,413 @@
Add Hurd toolchain support to Clang
https://reviews.llvm.org/D54379
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Basic/Targets/OSTargets.h
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Basic/Targets/OSTargets.h
@@ -270,6 +270,29 @@ public:
}
};
+// Hurd target
+template <typename Target>
+class LLVM_LIBRARY_VISIBILITY HurdTargetInfo : public OSTargetInfo<Target> {
+protected:
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+ MacroBuilder &Builder) const override {
+ // Linux defines; list based off of gcc output
+ DefineStd(Builder, "unix", Opts);
+ Builder.defineMacro("__GNU__");
+ Builder.defineMacro("__gnu_hurd__");
+ Builder.defineMacro("__MACH__");
+ Builder.defineMacro("__GLIBC__");
+ Builder.defineMacro("__ELF__");
+ if (Opts.POSIXThreads)
+ Builder.defineMacro("_REENTRANT");
+ if (Opts.CPlusPlus)
+ Builder.defineMacro("_GNU_SOURCE");
+ }
+public:
+ HurdTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+ : OSTargetInfo<Target>(Triple, Opts) {}
+};
+
// Minix Target
template <typename Target>
class LLVM_LIBRARY_VISIBILITY MinixTargetInfo : public OSTargetInfo<Target> {
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Basic/Targets.cpp
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Basic/Targets.cpp
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Basic/Targets.cpp
@@ -495,6 +495,8 @@ TargetInfo *AllocateTarget(const llvm::T
return new NaClTargetInfo<X86_32TargetInfo>(Triple, Opts);
case llvm::Triple::ELFIAMCU:
return new MCUX86_32TargetInfo(Triple, Opts);
+ case llvm::Triple::Hurd:
+ return new HurdTargetInfo<X86_32TargetInfo>(Triple, Opts);
default:
return new X86_32TargetInfo(Triple, Opts);
}
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/CMakeLists.txt
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Driver/CMakeLists.txt
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/CMakeLists.txt
@@ -47,6 +47,7 @@ add_clang_library(clangDriver
ToolChains/Haiku.cpp
ToolChains/HIP.cpp
ToolChains/Hexagon.cpp
+ ToolChains/Hurd.cpp
ToolChains/Linux.cpp
ToolChains/MipsLinux.cpp
ToolChains/MinGW.cpp
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/Driver.cpp
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Driver/Driver.cpp
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/Driver.cpp
@@ -26,6 +26,7 @@
#include "ToolChains/HIP.h"
#include "ToolChains/Haiku.h"
#include "ToolChains/Hexagon.h"
+#include "ToolChains/Hurd.h"
#include "ToolChains/Lanai.h"
#include "ToolChains/Linux.h"
#include "ToolChains/MSVC.h"
@@ -399,6 +400,13 @@ static llvm::Triple computeTargetTriple(
llvm::Triple Target(llvm::Triple::normalize(TargetTriple));
+ // GNU/Hurd's triple should have been -hurd-gnu*, but was historically made
+ // -gnu* only, and we can not change this, so we have to detect that case as
+ // being the Hurd OS.
+ if (TargetTriple.find("-unknown-gnu") != StringRef::npos ||
+ TargetTriple.find("-pc-gnu") != StringRef::npos)
+ Target.setOSName("hurd");
+
// Handle Apple-specific options available here.
if (Target.isOSBinFormatMachO()) {
// If an explicit Darwin arch name is given, that trumps all.
@@ -4374,6 +4382,9 @@ const ToolChain &Driver::getToolChain(co
case llvm::Triple::Contiki:
TC = llvm::make_unique<toolchains::Contiki>(*this, Target, Args);
break;
+ case llvm::Triple::Hurd:
+ TC = llvm::make_unique<toolchains::Hurd>(*this, Target, Args);
+ break;
default:
// Of these targets, Hexagon is the only one that might have
// an OS of Linux, in which case it got handled above already.
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Driver/ToolChains/Clang.cpp
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Clang.cpp
@@ -528,7 +528,7 @@ static bool useFramePointerForTargetByDe
return !areOptimizationsEnabled(Args);
}
- if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) {
+ if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI || Triple.isOSHurd()) {
switch (Triple.getArch()) {
// Don't use a frame pointer on linux if optimizing for certain targets.
case llvm::Triple::mips64:
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Driver/ToolChains/Gnu.cpp
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1846,7 +1846,9 @@ void Generic_GCC::GCCInstallationDetecto
"i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
"i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux",
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
- "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu"};
+ "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu",
+ "i386-gnu", "i486-gnu", "i586-gnu",
+ "i686-gnu"};
static const char *const MIPSLibDirs[] = {"/lib"};
static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
@@ -2210,6 +2212,9 @@ void Generic_GCC::GCCInstallationDetecto
// triple.
{"i386-linux-gnu/gcc/" + CandidateTriple.str(), "../../..",
(TargetArch == llvm::Triple::x86 &&
+ TargetTriple.getOS() != llvm::Triple::Solaris)},
+ {"i386-gnu/gcc/" + CandidateTriple.str(), "../../..",
+ (TargetArch == llvm::Triple::x86 &&
TargetTriple.getOS() != llvm::Triple::Solaris)}};
for (auto &Suffix : Suffixes) {
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Hurd.cpp
===================================================================
--- /dev/null
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Hurd.cpp
@@ -0,0 +1,191 @@
+//===--- Hurd.cpp - Hurd ToolChain Implementations --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Hurd.h"
+#include "CommonArgs.h"
+#include "clang/Basic/VirtualFileSystem.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/Options.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang;
+using namespace llvm::opt;
+
+using tools::addPathIfExists;
+
+/// Get our best guess at the multiarch triple for a target.
+///
+/// Debian-based systems are starting to use a multiarch setup where they use
+/// a target-triple directory in the library and header search paths.
+/// Unfortunately, this triple does not align with the vanilla target triple,
+/// so we provide a rough mapping here.
+static std::string getMultiarchTriple(const Driver &D,
+ const llvm::Triple &TargetTriple,
+ StringRef SysRoot) {
+ // For most architectures, just use whatever we have rather than trying to be
+ // clever.
+ switch (TargetTriple.getArch()) {
+ default:
+ break;
+
+ // We use the existence of '/lib/<triple>' as a directory to detect some
+ // common hurd triples that don't quite match the Clang triple for both
+ // 32-bit and 64-bit targets. Multiarch fixes its install triples to these
+ // regardless of what the actual target triple is.
+ case llvm::Triple::x86:
+ if (D.getVFS().exists(SysRoot + "/lib/i386-gnu"))
+ return "i386-gnu";
+ break;
+ }
+
+ return TargetTriple.str();
+}
+
+static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
+ // It happens that only x86 and PPC use the 'lib32' variant of oslibdir, and
+ // using that variant while targeting other architectures causes problems
+ // because the libraries are laid out in shared system roots that can't cope
+ // with a 'lib32' library search path being considered. So we only enable
+ // them when we know we may need it.
+ //
+ // FIXME: This is a bit of a hack. We should really unify this code for
+ // reasoning about oslibdir spellings with the lib dir spellings in the
+ // GCCInstallationDetector, but that is a more significant refactoring.
+
+ if (Triple.getArch() == llvm::Triple::x86)
+ return "lib32";
+
+ return Triple.isArch32Bit() ? "lib" : "lib64";
+}
+
+Hurd::Hurd(const Driver &D, const llvm::Triple &Triple,
+ const ArgList &Args)
+ : Generic_ELF(D, Triple, Args) {
+ std::string SysRoot = computeSysRoot();
+ path_list &Paths = getFilePaths();
+
+ const std::string OSLibDir = getOSLibDir(Triple, Args);
+ const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
+
+ // Similar to the logic for GCC above, if we currently running Clang inside
+ // of the requested system root, add its parent library paths to
+ // those searched.
+ // FIXME: It's not clear whether we should use the driver's installed
+ // directory ('Dir' below) or the ResourceDir.
+ if (StringRef(D.Dir).startswith(SysRoot)) {
+ addPathIfExists(D, D.Dir + "/../lib/" + MultiarchTriple, Paths);
+ addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
+ }
+
+ addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
+ addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
+
+ addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
+ addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
+
+ // If we are currently running Clang inside of the requested system root, add
+ // its parent library path to those searched.
+ // FIXME: It's not clear whether we should use the driver's installed
+ // directory ('Dir' below) or the ResourceDir.
+ if (StringRef(D.Dir).startswith(SysRoot))
+ addPathIfExists(D, D.Dir + "/../lib", Paths);
+
+ addPathIfExists(D, SysRoot + "/lib", Paths);
+ addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+}
+
+bool Hurd::HasNativeLLVMSupport() const { return true; }
+
+Tool *Hurd::buildLinker() const { return new tools::gnutools::Linker(*this); }
+
+Tool *Hurd::buildAssembler() const {
+ return new tools::gnutools::Assembler(*this);
+}
+
+std::string Hurd::computeSysRoot() const {
+ if (!getDriver().SysRoot.empty())
+ return getDriver().SysRoot;
+
+ return std::string();
+}
+
+std::string Hurd::getDynamicLinker(const ArgList &Args) const {
+ const llvm::Triple::ArchType Arch = getArch();
+
+ if (Arch == llvm::Triple::x86)
+ return "/lib/ld.so";
+
+ llvm_unreachable("unsupported architecture");
+}
+
+void Hurd::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+ ArgStringList &CC1Args) const {
+ const Driver &D = getDriver();
+ std::string SysRoot = computeSysRoot();
+
+ if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
+ return;
+
+ if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
+
+ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+ SmallString<128> P(D.ResourceDir);
+ llvm::sys::path::append(P, "include");
+ addSystemInclude(DriverArgs, CC1Args, P);
+ }
+
+ if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+ return;
+
+ // Check for configure-time C include directories.
+ StringRef CIncludeDirs(C_INCLUDE_DIRS);
+ if (CIncludeDirs != "") {
+ SmallVector<StringRef, 5> dirs;
+ CIncludeDirs.split(dirs, ":");
+ for (StringRef dir : dirs) {
+ StringRef Prefix =
+ llvm::sys::path::is_absolute(dir) ? StringRef(SysRoot) : "";
+ addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
+ }
+ return;
+ }
+
+ // Lacking those, try to detect the correct set of system includes for the
+ // target triple.
+
+ const StringRef X86MultiarchIncludeDirs[] = {
+ "/usr/include/i386-gnu"};
+
+ ArrayRef<StringRef> MultiarchIncludeDirs;
+ switch (getTriple().getArch()) {
+ case llvm::Triple::x86:
+ MultiarchIncludeDirs = X86MultiarchIncludeDirs;
+ break;
+ default:
+ break;
+ }
+
+ for (StringRef Dir : MultiarchIncludeDirs) {
+ if (D.getVFS().exists(SysRoot + Dir)) {
+ addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + Dir);
+ break;
+ }
+ }
+
+ // Add an include of '/include' directly. This isn't provided by default by
+ // system GCCs, but is often used with cross-compiling GCCs, and harmless to
+ // add even when Clang is acting as-if it were a system compiler.
+ addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
+
+ addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
+}
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Hurd.h
===================================================================
--- /dev/null
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Driver/ToolChains/Hurd.h
@@ -0,0 +1,46 @@
+//===--- Hurd.h - Hurd ToolChain Implementations ----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_Hurd_H
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_Hurd_H
+
+#include "Gnu.h"
+#include "clang/Driver/ToolChain.h"
+
+namespace clang {
+namespace driver {
+namespace toolchains {
+
+class LLVM_LIBRARY_VISIBILITY Hurd : public Generic_ELF {
+public:
+ Hurd(const Driver &D, const llvm::Triple &Triple,
+ const llvm::opt::ArgList &Args);
+
+ bool HasNativeLLVMSupport() const override;
+
+ void
+ AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const override;
+
+ virtual std::string computeSysRoot() const;
+
+ virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const;
+
+ std::vector<std::string> ExtraOpts;
+
+protected:
+ Tool *buildAssembler() const override;
+ Tool *buildLinker() const override;
+};
+
+} // end namespace toolchains
+} // end namespace driver
+} // end namespace clang
+
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_Hurd_H
Index: llvm-toolchain-7-7.0.1~+rc2/clang/lib/Frontend/InitHeaderSearch.cpp
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/clang/lib/Frontend/InitHeaderSearch.cpp
+++ llvm-toolchain-7-7.0.1~+rc2/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -260,6 +260,7 @@ void InitHeaderSearch::AddDefaultCInclud
switch (os) {
case llvm::Triple::Linux:
+ case llvm::Triple::Hurd:
case llvm::Triple::Solaris:
llvm_unreachable("Include management is handled in the driver.");
@@ -412,6 +413,7 @@
switch (os) {
case llvm::Triple::Linux:
+ case llvm::Triple::Hurd:
case llvm::Triple::Solaris:
llvm_unreachable("Include management is handled in the driver.");
break;
@@ -460,6 +462,7 @@
break; // Everything else continues to use this routine's logic.
case llvm::Triple::Linux:
+ case llvm::Triple::Hurd:
case llvm::Triple::Solaris:
return;

View File

@ -0,0 +1,64 @@
[hurd] Fix unconditional use of PATH_MAX
The GNU/Hurd system does not define an arbitrary PATH_MAX limitation, the POSIX 2001 realpath extension can be used instead, and the size of symlinks can be determined.
https://reviews.llvm.org/D54677
Index: llvm-toolchain-7_7.0.1~svn347285/libcxx/src/filesystem/operations.cpp
===================================================================
--- llvm-toolchain-7_7.0.1~svn347285.orig/libcxx/src/filesystem/operations.cpp
+++ llvm-toolchain-7_7.0.1~svn347285/libcxx/src/filesystem/operations.cpp
@@ -531,11 +531,20 @@ path __canonical(path const& orig_p, err
ErrorHandler<path> err("canonical", ec, &orig_p, &cwd);
path p = __do_absolute(orig_p, &cwd, ec);
+#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
+ char *buff;
+ if ((buff = ::realpath(p.c_str(), NULL)) == nullptr)
+ return err.report(capture_errno());
+ path ret = {buff};
+ free(buff);
+ return ret;
+#else
char buff[PATH_MAX + 1];
char* ret;
if ((ret = ::realpath(p.c_str(), buff)) == nullptr)
return err.report(capture_errno());
return {ret};
+#endif
}
void __copy(const path& from, const path& to, copy_options options,
@@ -1077,16 +1086,27 @@ void __permissions(const path& p, perms
path __read_symlink(const path& p, error_code* ec) {
ErrorHandler<path> err("read_symlink", ec, &p);
- char buff[PATH_MAX + 1];
- error_code m_ec;
+ struct stat sb;
+ if (lstat(p.c_str(), &sb) == -1) {
+ return err.report(capture_errno());
+ }
+ size_t size = sb.st_size + 1;
+ char *buff = (char*) malloc(size);
+ if (buff == NULL) {
+ return err.report(capture_errno());
+ }
+
::ssize_t ret;
- if ((ret = ::readlink(p.c_str(), buff, PATH_MAX)) == -1) {
+ if ((ret = ::readlink(p.c_str(), buff, size)) == -1) {
+ free(buff);
return err.report(capture_errno());
}
- _LIBCPP_ASSERT(ret <= PATH_MAX, "TODO");
+ _LIBCPP_ASSERT(ret < size, "TODO");
_LIBCPP_ASSERT(ret > 0, "TODO");
buff[ret] = 0;
- return {buff};
+ path res = {buff};
+ free(buff);
+ return res;
}
bool __remove(const path& p, error_code* ec) {

View File

@ -0,0 +1,14 @@
Index: llvm-toolchain-snapshot_3.9~svn268880/utils/TableGen/CodeEmitterGen.cpp
===================================================================
--- llvm-toolchain-snapshot_3.9~svn268880.orig/utils/TableGen/CodeEmitterGen.cpp
+++ llvm-toolchain-snapshot_3.9~svn268880/utils/TableGen/CodeEmitterGen.cpp
@@ -229,6 +229,9 @@ void CodeEmitterGen::run(raw_ostream &o)
ArrayRef<const CodeGenInstruction*> NumberedInstructions =
Target.getInstructionsByEnumValue();
+ o << "// Undef for HURD\n";
+ o << "#ifdef EIEIO\n#undef EIEIO\n#endif\n";
+
// Emit function declaration
o << "uint64_t " << Target.getName();
o << "MCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,\n"

281
debian/patches/hurd/hurd-cxx-paths.diff vendored Normal file
View File

@ -0,0 +1,281 @@
This should be factorized with Linux.cpp and the GNU/kFreeBSD case.
Index: llvm-toolchain-7_7.0.1~svn347285/clang/lib/Driver/ToolChains/Hurd.cpp
===================================================================
--- llvm-toolchain-7_7.0.1~svn347285.orig/clang/lib/Driver/ToolChains/Hurd.cpp
+++ llvm-toolchain-7_7.0.1~svn347285/clang/lib/Driver/ToolChains/Hurd.cpp
@@ -67,15 +67,102 @@ static StringRef getOSLibDir(const llvm:
return Triple.isArch32Bit() ? "lib" : "lib64";
}
+static void addMultilibsFilePaths(const Driver &D, const MultilibSet &Multilibs,
+ const Multilib &Multilib,
+ StringRef InstallPath,
+ ToolChain::path_list &Paths) {
+ if (const auto &PathsCallback = Multilibs.filePathsCallback())
+ for (const auto &Path : PathsCallback(Multilib))
+ addPathIfExists(D, InstallPath + Path, Paths);
+}
+
Hurd::Hurd(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: Generic_ELF(D, Triple, Args) {
+ GCCInstallation.init(Triple, Args);
+ Multilibs = GCCInstallation.getMultilibs();
std::string SysRoot = computeSysRoot();
+
+ // Cross-compiling binutils and GCC installations (vanilla and openSUSE at
+ // least) put various tools in a triple-prefixed directory off of the parent
+ // of the GCC installation. We use the GCC triple here to ensure that we end
+ // up with tools that support the same amount of cross compiling as the
+ // detected GCC installation. For example, if we find a GCC installation
+ // targeting x86_64, but it is a bi-arch GCC installation, it can also be
+ // used to target i386.
+ // FIXME: This seems unlikely to be Linux- or Hurd-specific.
+ ToolChain::path_list &PPaths = getProgramPaths();
+ PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
+ GCCInstallation.getTriple().str() + "/bin")
+ .str());
+
+#ifdef ENABLE_LINKER_BUILD_ID
+ ExtraOpts.push_back("--build-id");
+#endif
+
+ // The selection of paths to try here is designed to match the patterns which
+ // the GCC driver itself uses, as this is part of the GCC-compatible driver.
+ // This was determined by running GCC in a fake filesystem, creating all
+ // possible permutations of these directories, and seeing which ones it added
+ // to the link paths.
path_list &Paths = getFilePaths();
const std::string OSLibDir = getOSLibDir(Triple, Args);
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
+ // Add the multilib suffixed paths where they are available.
+ if (GCCInstallation.isValid()) {
+ const llvm::Triple &GCCTriple = GCCInstallation.getTriple();
+ const std::string &LibPath = GCCInstallation.getParentLibPath();
+ const Multilib &Multilib = GCCInstallation.getMultilib();
+ const MultilibSet &Multilibs = GCCInstallation.getMultilibs();
+
+ // Add toolchain / multilib specific file paths.
+ addMultilibsFilePaths(D, Multilibs, Multilib,
+ GCCInstallation.getInstallPath(), Paths);
+
+ // Sourcery CodeBench MIPS toolchain holds some libraries under
+ // a biarch-like suffix of the GCC installation.
+ addPathIfExists(D, GCCInstallation.getInstallPath() + Multilib.gccSuffix(),
+ Paths);
+
+ // GCC cross compiling toolchains will install target libraries which ship
+ // as part of the toolchain under <prefix>/<triple>/<libdir> rather than as
+ // any part of the GCC installation in
+ // <prefix>/<libdir>/gcc/<triple>/<version>. This decision is somewhat
+ // debatable, but is the reality today. We need to search this tree even
+ // when we have a sysroot somewhere else. It is the responsibility of
+ // whomever is doing the cross build targeting a sysroot using a GCC
+ // installation that is *not* within the system root to ensure two things:
+ //
+ // 1) Any DSOs that are linked in from this tree or from the install path
+ // above must be present on the system root and found via an
+ // appropriate rpath.
+ // 2) There must not be libraries installed into
+ // <prefix>/<triple>/<libdir> unless they should be preferred over
+ // those within the system root.
+ //
+ // Note that this matches the GCC behavior. See the below comment for where
+ // Clang diverges from GCC's behavior.
+ addPathIfExists(D, LibPath + "/../" + GCCTriple.str() + "/lib/../" +
+ OSLibDir + Multilib.osSuffix(),
+ Paths);
+
+ // If the GCC installation we found is inside of the sysroot, we want to
+ // prefer libraries installed in the parent prefix of the GCC installation.
+ // It is important to *not* use these paths when the GCC installation is
+ // outside of the system root as that can pick up unintended libraries.
+ // This usually happens when there is an external cross compiler on the
+ // host system, and a more minimal sysroot available that is the target of
+ // the cross. Note that GCC does include some of these directories in some
+ // configurations but this seems somewhere between questionable and simply
+ // a bug.
+ if (StringRef(LibPath).startswith(SysRoot)) {
+ addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths);
+ addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
+ }
+ }
+
// Similar to the logic for GCC above, if we currently running Clang inside
// of the requested system root, add its parent library paths to
// those searched.
@@ -92,8 +179,40 @@ Hurd::Hurd(const Driver &D, const llvm::
addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
- // If we are currently running Clang inside of the requested system root, add
- // its parent library path to those searched.
+ // Try walking via the GCC triple path in case of biarch or multiarch GCC
+ // installations with strange symlinks.
+ if (GCCInstallation.isValid()) {
+ addPathIfExists(D,
+ SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
+ "/../../" + OSLibDir,
+ Paths);
+
+ // Add the 'other' biarch variant path
+ Multilib BiarchSibling;
+ if (GCCInstallation.getBiarchSibling(BiarchSibling)) {
+ addPathIfExists(D, GCCInstallation.getInstallPath() +
+ BiarchSibling.gccSuffix(),
+ Paths);
+ }
+
+ // See comments above on the multilib variant for details of why this is
+ // included even from outside the sysroot.
+ const std::string &LibPath = GCCInstallation.getParentLibPath();
+ const llvm::Triple &GCCTriple = GCCInstallation.getTriple();
+ const Multilib &Multilib = GCCInstallation.getMultilib();
+ addPathIfExists(D, LibPath + "/../" + GCCTriple.str() + "/lib" +
+ Multilib.osSuffix(),
+ Paths);
+
+ // See comments above on the multilib variant for details of why this is
+ // only included from within the sysroot.
+ if (StringRef(LibPath).startswith(SysRoot))
+ addPathIfExists(D, LibPath, Paths);
+ }
+
+ // Similar to the logic for GCC above, if we are currently running Clang
+ // inside of the requested system root, add its parent library path to those
+ // searched.
// FIXME: It's not clear whether we should use the driver's installed
// directory ('Dir' below) or the ResourceDir.
if (StringRef(D.Dir).startswith(SysRoot))
@@ -163,6 +282,16 @@ void Hurd::AddClangSystemIncludeArgs(con
// Lacking those, try to detect the correct set of system includes for the
// target triple.
+ // Add include directories specific to the selected multilib set and multilib.
+ if (GCCInstallation.isValid()) {
+ const auto &Callback = Multilibs.includeDirsCallback();
+ if (Callback) {
+ for (const auto &Path : Callback(GCCInstallation.getMultilib()))
+ addExternCSystemIncludeIfExists(
+ DriverArgs, CC1Args, GCCInstallation.getInstallPath() + Path);
+ }
+ }
+
const StringRef X86MultiarchIncludeDirs[] = {
"/usr/include/i386-gnu"};
@@ -189,3 +318,94 @@ void Hurd::AddClangSystemIncludeArgs(con
addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
}
+
+static std::string DetectLibcxxIncludePath(StringRef base) {
+ std::error_code EC;
+ int MaxVersion = 0;
+ std::string MaxVersionString = "";
+ for (llvm::sys::fs::directory_iterator LI(base, EC), LE; !EC && LI != LE;
+ LI = LI.increment(EC)) {
+ StringRef VersionText = llvm::sys::path::filename(LI->path());
+ int Version;
+ if (VersionText[0] == 'v' &&
+ !VersionText.slice(1, StringRef::npos).getAsInteger(10, Version)) {
+ if (Version > MaxVersion) {
+ MaxVersion = Version;
+ MaxVersionString = VersionText;
+ }
+ }
+ }
+ return MaxVersion ? (base + "/" + MaxVersionString).str() : "";
+}
+
+void Hurd::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const {
+ const std::string& SysRoot = computeSysRoot();
+ const std::string LibCXXIncludePathCandidates[] = {
+ DetectLibcxxIncludePath(getDriver().ResourceDir + "/include/c++"),
+ DetectLibcxxIncludePath(getDriver().Dir + "/../include/c++"),
+ // If this is a development, non-installed, clang, libcxx will
+ // not be found at ../include/c++ but it likely to be found at
+ // one of the following two locations:
+ DetectLibcxxIncludePath(SysRoot + "/usr/local/include/c++"),
+ DetectLibcxxIncludePath(SysRoot + "/usr/include/c++") };
+ for (const auto &IncludePath : LibCXXIncludePathCandidates) {
+ if (IncludePath.empty() || !getVFS().exists(IncludePath))
+ continue;
+ // Use the first candidate that exists.
+ addSystemInclude(DriverArgs, CC1Args, IncludePath);
+ return;
+ }
+}
+
+void Hurd::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const {
+ // We need a detected GCC installation on Hurd to provide libstdc++'s
+ // headers.
+ if (!GCCInstallation.isValid())
+ return;
+
+ // By default, look for the C++ headers in an include directory adjacent to
+ // the lib directory of the GCC installation. Note that this is expect to be
+ // equivalent to '/usr/include/c++/X.Y' in almost all cases.
+ StringRef LibDir = GCCInstallation.getParentLibPath();
+ StringRef InstallDir = GCCInstallation.getInstallPath();
+ StringRef TripleStr = GCCInstallation.getTriple().str();
+ const Multilib &Multilib = GCCInstallation.getMultilib();
+ const std::string GCCMultiarchTriple = getMultiarchTriple(
+ getDriver(), GCCInstallation.getTriple(), getDriver().SysRoot);
+ const std::string TargetMultiarchTriple =
+ getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot);
+ const GCCVersion &Version = GCCInstallation.getVersion();
+
+ // The primary search for libstdc++ supports multiarch variants.
+ if (addLibStdCXXIncludePaths(LibDir.str() + "/../include",
+ "/c++/" + Version.Text, TripleStr,
+ GCCMultiarchTriple, TargetMultiarchTriple,
+ Multilib.includeSuffix(), DriverArgs, CC1Args))
+ return;
+
+ // Otherwise, fall back on a bunch of options which don't use multiarch
+ // layouts for simplicity.
+ const std::string LibStdCXXIncludePathCandidates[] = {
+ // Gentoo is weird and places its headers inside the GCC install,
+ // so if the first attempt to find the headers fails, try these patterns.
+ InstallDir.str() + "/include/g++-v" + Version.Text,
+ InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." +
+ Version.MinorStr,
+ InstallDir.str() + "/include/g++-v" + Version.MajorStr,
+ // Android standalone toolchain has C++ headers in yet another place.
+ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
+ // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
+ // without a subdirectory corresponding to the gcc version.
+ LibDir.str() + "/../include/c++",
+ };
+
+ for (const auto &IncludePath : LibStdCXXIncludePathCandidates) {
+ if (addLibStdCXXIncludePaths(IncludePath, /*Suffix*/ "", TripleStr,
+ /*GCCMultiarchTriple*/ "",
+ /*TargetMultiarchTriple*/ "",
+ Multilib.includeSuffix(), DriverArgs, CC1Args))
+ break;
+ }
+}
Index: llvm-toolchain-7_7.0.1~svn347285/clang/lib/Driver/ToolChains/Hurd.h
===================================================================
--- llvm-toolchain-7_7.0.1~svn347285.orig/clang/lib/Driver/ToolChains/Hurd.h
+++ llvm-toolchain-7_7.0.1~svn347285/clang/lib/Driver/ToolChains/Hurd.h
@@ -27,6 +27,12 @@ public:
void
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
+ void addLibCxxIncludePaths(
+ const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const override;
+ void addLibStdCxxIncludePaths(
+ const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const override;
virtual std::string computeSysRoot() const;

View File

@ -0,0 +1,43 @@
Index: llvm-toolchain-7-7/lib/Support/Unix/Path.inc
===================================================================
--- llvm-toolchain-7-7.orig/lib/Support/Unix/Path.inc
+++ llvm-toolchain-7-7/lib/Support/Unix/Path.inc
@@ -83,7 +83,7 @@
#define STATVFS_F_FRSIZE(vfs) static_cast<uint64_t>(vfs.f_bsize)
#endif
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) || defined(__GNU__)
#define STATVFS_F_FLAG(vfs) (vfs).f_flag
#else
#define STATVFS_F_FLAG(vfs) (vfs).f_flags
@@ -99,7 +99,7 @@ const file_t kInvalidFile = -1;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
defined(__minix) || defined(__FreeBSD_kernel__) || defined(__linux__) || \
- defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX)
+ defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || defined(__GNU__)
static int
test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
{
@@ -348,7 +348,7 @@ std::error_code remove(const Twine &path
}
static bool is_local_impl(struct STATVFS &Vfs) {
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GNU__)
#ifndef NFS_SUPER_MAGIC
#define NFS_SUPER_MAGIC 0x6969
#endif
@@ -358,7 +358,11 @@ static bool is_local_impl(struct STATVFS
#ifndef CIFS_MAGIC_NUMBER
#define CIFS_MAGIC_NUMBER 0xFF534D42
#endif
+#ifdef __GNU__
+ switch ((uint32_t)Vfs.__f_type) {
+#else
switch ((uint32_t)Vfs.f_type) {
+#endif
case NFS_SUPER_MAGIC:
case SMB_SUPER_MAGIC:
case CIFS_MAGIC_NUMBER:

93
debian/patches/hurd/hurd-pathmax.diff vendored Normal file
View File

@ -0,0 +1,93 @@
Index: llvm-toolchain-7_7.1.0~svn353565/clang/lib/Basic/FileManager.cpp
===================================================================
--- llvm-toolchain-7_7.1.0~svn353565.orig/clang/lib/Basic/FileManager.cpp
+++ llvm-toolchain-7_7.1.0~svn353565/clang/lib/Basic/FileManager.cpp
@@ -501,6 +501,12 @@ void FileManager::invalidateCache(const
UniqueRealFiles.erase(Entry->getUniqueID());
}
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
+
void FileManager::GetUniqueIDMapping(
SmallVectorImpl<const FileEntry *> &UIDToFiles) const {
UIDToFiles.clear();
Index: llvm-toolchain-7_7.1.0~svn353565/lldb/include/lldb/lldb-defines.h
===================================================================
--- llvm-toolchain-7_7.1.0~svn353565.orig/lldb/include/lldb/lldb-defines.h
+++ llvm-toolchain-7_7.1.0~svn353565/lldb/include/lldb/lldb-defines.h
@@ -28,6 +28,11 @@
#define INT32_MAX 2147483647
#endif
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
#if !defined(UINT32_MAX)
#define UINT32_MAX 4294967295U
#endif
Index: llvm-toolchain-7_7.1.0~svn353565/lib/Support/Unix/Path.inc
===================================================================
--- llvm-toolchain-7_7.1.0~svn353565.orig/lib/Support/Unix/Path.inc
+++ llvm-toolchain-7_7.1.0~svn353565/lib/Support/Unix/Path.inc
@@ -49,6 +49,7 @@
// For GNU Hurd
#if defined(__GNU__) && !defined(PATH_MAX)
# define PATH_MAX 4096
+# define MAXPATHLEN 4096
#endif
#include <sys/types.h>
Index: llvm-toolchain-7_7.1.0~svn353565/tools/dsymutil/DwarfLinker.cpp
===================================================================
--- llvm-toolchain-7_7.1.0~svn353565.orig/tools/dsymutil/DwarfLinker.cpp
+++ llvm-toolchain-7_7.1.0~svn353565/tools/dsymutil/DwarfLinker.cpp
@@ -101,6 +101,11 @@
#include <utility>
#include <vector>
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
namespace llvm {
namespace dsymutil {
Index: llvm-toolchain-7_7.1.0~svn353565/polly/lib/External/ppcg/cuda_common.c
===================================================================
--- llvm-toolchain-7_7.1.0~svn353565.orig/polly/lib/External/ppcg/cuda_common.c
+++ llvm-toolchain-7_7.1.0~svn353565/polly/lib/External/ppcg/cuda_common.c
@@ -15,6 +15,11 @@
#include "cuda_common.h"
#include "ppcg.h"
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
/* Open the host .cu file and the kernel .hu and .cu files for writing.
* Add the necessary includes.
*/
Index: llvm-toolchain-7_7.1.0~svn353565/clang/lib/Frontend/ModuleDependencyCollector.cpp
===================================================================
--- llvm-toolchain-7_7.1.0~svn353565.orig/clang/lib/Frontend/ModuleDependencyCollector.cpp
+++ llvm-toolchain-7_7.1.0~svn353565/clang/lib/Frontend/ModuleDependencyCollector.cpp
@@ -99,6 +99,11 @@ struct ModuleDependencyMMCallbacks : pub
}
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
// TODO: move this to Support/Path.h and check for HAVE_REALPATH?
static bool real_path(StringRef SrcPath, SmallVectorImpl<char> &RealPath) {
#ifdef LLVM_ON_UNIX

View File

@ -0,0 +1,12 @@
Index: llvm-toolchain-7-7/tools/llvm-shlib/CMakeLists.txt
===================================================================
--- llvm-toolchain-7-7.orig/tools/llvm-shlib/CMakeLists.txt
+++ llvm-toolchain-7-7/tools/llvm-shlib/CMakeLists.txt
@@ -40,6 +40,7 @@ set_property(TARGET LLVM PROPERTY VERSIO
list(REMOVE_DUPLICATES LIB_NAMES)
if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")

13
debian/patches/hurd/impl-path-hurd.diff vendored Normal file
View File

@ -0,0 +1,13 @@
Index: llvm-toolchain-snapshot_7~svn334230/lib/Support/Unix/Path.inc
===================================================================
--- llvm-toolchain-snapshot_7~svn334230.orig/lib/Support/Unix/Path.inc
+++ llvm-toolchain-snapshot_7~svn334230/lib/Support/Unix/Path.inc
@@ -175,7 +175,7 @@ std::string getMainExecutable(const char
if (getprogpath(exe_path, argv0) != NULL)
return exe_path;
-#elif defined(__linux__) || defined(__CYGWIN__)
+#elif defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__)
char exe_path[MAXPATHLEN];
StringRef aPath("/proc/self/exe");
if (sys::fs::exists(aPath)) {

View File

@ -0,0 +1,24 @@
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: *
// <condition_variable>
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
@@ -9,6 +9,7 @@
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// XFAIL: *
// <shared_mutex>

View File

@ -0,0 +1,13 @@
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
@@ -14,7 +14,7 @@
//
// GCC currently fails because it needs -fabi-version=6 to fix mangling of
// std::atomic when used with __attribute__((vector(X))).
-// XFAIL: gcc
+// XFAIL: *
// <atomic>

View File

@ -0,0 +1,51 @@
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
@@ -12,6 +12,8 @@
// template<class RealType, size_t bits, class URNG>
// RealType generate_canonical(URNG& g);
+// XFAIL: *
+
#include <random>
#include <cassert>
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/re/re.traits/isctype.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/re/re.traits/isctype.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/re/re.traits/isctype.pass.cpp
@@ -16,6 +16,7 @@
// TODO(EricWF): This test takes 40+ minutes to build with Clang 3.8 under ASAN or MSAN.
// UNSUPPORTED: asan, msan
+// XFAIL: *
#include <regex>
#include <cassert>
Index: llvm-toolchain-snapshot_7~svn337372/libcxxabi/test/catch_multi_level_pointer.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxxabi/test/catch_multi_level_pointer.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxxabi/test/catch_multi_level_pointer.pass.cpp
@@ -9,6 +9,8 @@
// UNSUPPORTED: libcxxabi-no-exceptions
+// XFAIL: *
+
#include <cassert>
#include <cstdlib>
#include <iostream>
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
@@ -16,6 +16,8 @@
// template <class T, class... Args> void construct(T* p, Args&&... args);
+// XFAIL: *
+
#include <scoped_allocator>
#include <cassert>
#include <string>

View File

@ -0,0 +1,58 @@
Clang 3.9 regression causes a bug when generating code for
std::atomic_compare_and_exchange*(std::atomic<long long>,...) without
optimizations. If same code is compiled with -O2 tests pass without problems.
Atomics are implement in headers with builtin functions which makes this
affect application code instead of libc++ library code.
libcxx tests default to -O0 compilation so these test need to be marked failing
on arm to allow installing packages. Use cases is so borderline failure that it
shouldn't prevent building the package. (64bit atomics in 32bit mode)
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: arm
// ... assertion fails line 34
// <atomic>
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: arm
// ... assertion fails line 38
// <atomic>
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: arm
// ... assertion fails line 34
// <atomic>
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: arm
// ... assertion fails line 38
// <atomic>

View File

@ -0,0 +1,31 @@
Lock is_always_lock free test fails on i386 because std::atomic is aligned
to 8 bytes while long long is aligned to 4 bytes. clang can't generate inline
code for unaligned 8 byte atomics even tough instruction set and gcc support
it.
That makes it expected thaqt ATOMIC_LLONG_LOCK_FREE and
std::atomic<long long>::is_always_lock_free don't match on i386. Correct test
for std::atomic<long long> is to check if target cpu support cmpxchg8 instruction.
To set instruction support one can check __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 define.
Bug: https://llvm.org/bugs/show_bug.cgi?id=19355
Index: llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
@@ -20,6 +20,14 @@
# error Feature test macro missing.
#endif
+#if defined(__i386__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
+/* Fix for clang setting __GCC_ATOMIC_LLONG_LOCK_FREE incorecctly for x86
+ * https://llvm.org/bugs/show_bug.cgi?id=19355
+ */
+#undef ATOMIC_LLONG_LOCK_FREE
+#define ATOMIC_LLONG_LOCK_FREE 2
+#endif
+
template <typename T> void checkAlwaysLockFree() {
if (std::atomic<T>::is_always_lock_free)
assert(std::atomic<T>().is_lock_free());

View File

@ -0,0 +1,118 @@
Fix arm EHABI code to work. armhf had exception test failing without EHABI support.
No known upstream bug about this. Actual code change is more like workaround than
something that upstream would accept. Proper fix would be adding _Unwind_Control_Block
to clang unwind.h. _Unwind_Control_Block should also extend _Unwind_Exception to make
sure their ABI stays in sync.
No known upstream bug about this.
Index: llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.cpp
===================================================================
--- llvm-toolchain-snapshot_7svn337372.orig/libcxxabi/src/cxa_exception.cpp
+++ llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.cpp
@@ -261,15 +261,16 @@ __cxa_throw(void *thrown_object, std::ty
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
-#else
+#elif !LIBCXXABI_ARM_EHABI
_Unwind_RaiseException(&exception_header->unwindHeader);
+#else
+ _Unwind_RaiseException(exception_header->unwindHeader);
#endif
// This only happens when there is no handler, or some unexpected unwinding
// error happens.
failed_throw(exception_header);
}
-
// 2.5.3 Exception Handlers
/*
The adjusted pointer is computed by the personality routine during phase 1
@@ -532,7 +533,11 @@ void __cxa_end_catch() {
// to touch a foreign exception in any way, that is undefined
// behavior. They likely can't since the only way to catch
// a foreign exception is with catch (...)!
+#if !LIBCXXABI_ARM_EHABI
_Unwind_DeleteException(&globals->caughtExceptions->unwindHeader);
+#else
+ _Unwind_DeleteException(globals->caughtExceptions->unwindHeader);
+#endif
globals->caughtExceptions = 0;
}
}
@@ -589,8 +594,10 @@ void __cxa_rethrow() {
}
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
-#else
+#elif !LIBCXXABI_ARM_EHABI
_Unwind_RaiseException(&exception_header->unwindHeader);
+#else
+ _Unwind_RaiseException(exception_header->unwindHeader);
#endif
// If we get here, some kind of unwinding error has occurred.
@@ -714,8 +721,10 @@ __cxa_rethrow_primary_exception(void* th
dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup;
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader);
+#elif !LIBCXXABI_ARM_EHABI
+ _Unwind_RaiseException(&dep_exception_header->unwindHeader);
#else
- _Unwind_RaiseException(&dep_exception_header->unwindHeader);
+ _Unwind_RaiseException(dep_exception_header->unwindHeader);
#endif
// Some sort of unwinding error. Note that terminate is a handler.
__cxa_begin_catch(&dep_exception_header->unwindHeader);
Index: llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.hpp
===================================================================
--- llvm-toolchain-snapshot_7svn337372.orig/libcxxabi/src/cxa_exception.hpp
+++ llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.hpp
@@ -24,6 +24,45 @@ static const uint64_t kOurExceptionClass
static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1
static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++
+#if LIBCXXABI_ARM_EHABI
+// GCC has _Unwind_Control_Block in unwind.h (unwind_arm_common.h)
+#if defined(__clang__)
+struct _Unwind_Control_Block
+{
+ uint64_t exception_class;
+ void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
+ struct {
+ _Unwind_Word reserved1;
+ _Unwind_Word reserved2;
+ _Unwind_Word reserved3;
+ _Unwind_Word reserved4;
+ _Unwind_Word reserved5;
+ } unwinder_cache;
+ struct {
+ _Unwind_Word sp;
+ _Unwind_Word bitpattern[5];
+ } barrier_cache;
+ struct {
+ _Unwind_Word bitpattern[4];
+ } cleanup_cache;
+ struct {
+ _Unwind_Word fnstart;
+ _Unwind_Word *ehtp;
+ _Unwind_Word additional;
+ _Unwind_Word reserved1;
+ } pr_cache;
+ long long int :0;
+ operator _Unwind_Exception*() noexcept
+ {
+ return reinterpret_cast<_Unwind_Exception*>(this);
+ }
+};
+
+#endif
+
+#define _Unwind_Exception _Unwind_Control_Block
+#endif
+
struct _LIBCXXABI_HIDDEN __cxa_exception {
#if defined(__LP64__) || defined(_LIBCXXABI_ARM_EHABI)
// This is a new field to support C++ 0x exception_ptr.

View File

@ -0,0 +1,17 @@
Powerpc has extended double that doesn't match x86 coding. Power format would
need special tests to verify correctness but for now it is enough to prevent
incorrect test from running.
Index: llvm-toolchain-snapshot_7~svn337372/libcxxabi/test/test_demangle.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxxabi/test/test_demangle.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372svn337372/libcxxabi/test/test_demangle.pass.cpp
@@ -29648,7 +29648,7 @@ const char* invalid_cases[] =
"NSoERj5E=Y1[uM:ga",
"Aon_PmKVPDk7?fg4XP5smMUL6;<WsI_mgbf23cCgsHbT<l8EE\0uVRkNOoXDrgdA4[8IU>Vl<>IL8ayHpiVDDDXTY;^o9;i",
"_ZNSt16allocator_traitsISaIN4llvm3sys2fs18directory_iteratorEEE9constructIS3_IS3_EEEDTcl12_S_constructfp_fp0_spcl7forwardIT0_Efp1_EEERS4_PT_DpOS7_",
-#if !LDBL_FP80
+#if !LDBL_FP80 && __LDBL_MANT_DIG__ < 64
"_ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c",
#endif
// The following test cases were found by libFuzzer+ASAN

View File

@ -110,9 +110,10 @@ hurd-EIEIO-undef.diff
impl-path-hurd.diff
# powerpcspe
D49754-powerpcspe-clang.diff
D54409-powerpcspe-register-spilling.diff
D54584-powerpcspe-double-parameter.diff
powerpcspe/D49754-powerpcspe-clang.diff
powerpcspe/D54409-powerpcspe-register-spilling.diff
powerpcspe/D54584-powerpcspe-double-parameter.diff
# Disable https://llvm.org/viewvc/llvm-project?view=revision&revision=352580
# 7.0.1 was always abi compatible with 7.0