diff options
Diffstat (limited to 'debian/patches/hurd')
-rw-r--r-- | debian/patches/hurd/D54677-hurd-path_max.diff | 64 | ||||
-rw-r--r-- | debian/patches/hurd/hurd-EIEIO-undef.diff | 14 | ||||
-rw-r--r-- | debian/patches/hurd/hurd-pathmax.diff | 81 | ||||
-rw-r--r-- | debian/patches/hurd/impl-path-hurd.diff | 13 |
4 files changed, 172 insertions, 0 deletions
diff --git a/debian/patches/hurd/D54677-hurd-path_max.diff b/debian/patches/hurd/D54677-hurd-path_max.diff new file mode 100644 index 0000000..f0cafd1 --- /dev/null +++ b/debian/patches/hurd/D54677-hurd-path_max.diff @@ -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) { diff --git a/debian/patches/hurd/hurd-EIEIO-undef.diff b/debian/patches/hurd/hurd-EIEIO-undef.diff new file mode 100644 index 0000000..3b98ad9 --- /dev/null +++ b/debian/patches/hurd/hurd-EIEIO-undef.diff @@ -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" diff --git a/debian/patches/hurd/hurd-pathmax.diff b/debian/patches/hurd/hurd-pathmax.diff new file mode 100644 index 0000000..d9ba159 --- /dev/null +++ b/debian/patches/hurd/hurd-pathmax.diff @@ -0,0 +1,81 @@ +Index: llvm-toolchain-8_8~svn353935/clang/lib/Basic/FileManager.cpp +=================================================================== +--- llvm-toolchain-8_8~svn353935.orig/clang/lib/Basic/FileManager.cpp ++++ llvm-toolchain-8_8~svn353935/clang/lib/Basic/FileManager.cpp +@@ -483,6 +483,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-8_8~svn353935/lldb/include/lldb/lldb-defines.h +=================================================================== +--- llvm-toolchain-8_8~svn353935.orig/lldb/include/lldb/lldb-defines.h ++++ llvm-toolchain-8_8~svn353935/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-8_8~svn353935/tools/dsymutil/DwarfLinker.cpp +=================================================================== +--- llvm-toolchain-8_8~svn353935.orig/tools/dsymutil/DwarfLinker.cpp ++++ llvm-toolchain-8_8~svn353935/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-8_8~svn353935/polly/lib/External/ppcg/cuda_common.c +=================================================================== +--- llvm-toolchain-8_8~svn353935.orig/polly/lib/External/ppcg/cuda_common.c ++++ llvm-toolchain-8_8~svn353935/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-8_8~svn353935/clang/lib/Frontend/ModuleDependencyCollector.cpp +=================================================================== +--- llvm-toolchain-8_8~svn353935.orig/clang/lib/Frontend/ModuleDependencyCollector.cpp ++++ llvm-toolchain-8_8~svn353935/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 diff --git a/debian/patches/hurd/impl-path-hurd.diff b/debian/patches/hurd/impl-path-hurd.diff new file mode 100644 index 0000000..4d7b7a6 --- /dev/null +++ b/debian/patches/hurd/impl-path-hurd.diff @@ -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)) { |