Commit 912892b0 authored by Sylvestre Ledru's avatar Sylvestre Ledru

move hurd patches in a directory

parent e7d8bf18
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.
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());
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__)
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__) || \
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());
This diff is collapsed.
[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) {
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"
This diff is collapsed.
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:
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
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")
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)) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment