Source: llvm-toolchain-6.0
Version: 6.0.1-9
Severity: important
Tags: ftbfs, patch
User: debian-h...@lists.debian.org
Usertags: hurd-i386

Hello,

Currently llvm-toolchain-6.0 FTBFS on GNU/Hurd due to missing porting
issues. Attached are three patches to fix this:
lib_Support_Unix_Path.inc.diff
tools_llvm-shlib_CMakeLists.txt.diff
clang_lib_Frontend_ModuleDependencyCollector.cpp.dif

The last patch is a PATH_MAX issue. Maybe it could be integrated with
the already present hurd-pathmax.diff patch.

Additionally the patch debian_rules.diff adds GNU/Hurd to the
architectures capable of using the gold linker.

Thanks!
Index: llvm-toolchain-6.0-6.0.1/clang/lib/Frontend/ModuleDependencyCollector.cpp
===================================================================
--- llvm-toolchain-6.0-6.0.1.orig/clang/lib/Frontend/ModuleDependencyCollector.cpp
+++ llvm-toolchain-6.0-6.0.1/clang/lib/Frontend/ModuleDependencyCollector.cpp
@@ -97,6 +97,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
--- a/debian/rules	2018-09-12 10:48:35.000000000 +0200
+++ b/debian/rules	2018-09-14 13:35:50.000000000 +0200
@@ -84,7 +84,7 @@
 	control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev'
 endif
 
-BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el sparc sparc64 x32 s390x
+BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el sparc sparc64 x32 s390x hurd-i386
 ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0)
 ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS)))
 # -fused-ld=gold enables the gold linker (but is not supported by all archs / distro)
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
@@ -98,7 +98,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
@@ -111,7 +111,7 @@ namespace sys  {
 namespace fs {
 #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)
 {
@@ -187,7 +187,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)) {
@@ -360,7 +360,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
@@ -370,7 +370,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-6.0-6.0.1/tools/llvm-shlib/CMakeLists.txt
===================================================================
--- llvm-toolchain-6.0-6.0.1.orig/tools/llvm-shlib/CMakeLists.txt
+++ llvm-toolchain-6.0-6.0.1/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 "DragonFly")
    OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf"
   configure_file(

Reply via email to