Source: llvm-3.0 Version: 3.0-4 Severity: important Tags: patch User: debian-h...@lists.debian.org Usertags: hurd
Hi, currently[1], llvm-3.0 fails to build on GNU/Hurd. Attached there is an improved version of the existing patch 0011-Hurd-fixes.path, adding changes in new files: * lib/Support/Unix/PathV2.inc: - hackish way to supply the missing PATH_MAX [not suitable for upstream] - in current_path(), use 1024 as starting size for the "result" variable; the code grows the buffer until it fails with ENOMEM or similar anyway, so it will at most do few (re)allocs more. [can be sent upstream] * Makefile.rules: - set a linker version script also on GNU/Hurd [can be sent upstream] * tools/llvm-shlib/Makefile: - use the --whole-archive/--no-whole-archive and --no-undefined linker flags also on GNU/Hurd [can be sent upstream] Regarding the test suite: currently most of the test fail, because we don't support $ORIGIN in RPATHs, yet. I wanted to see how the tests performed, so I manually exported LD_LIBRARY_PATH to $PWD/build-llvm/Release/lib, which gave as result (compared to linux-i386): - CodeGen/X86/2010-06-14-fast-isel-fs-load.ll failing (as on linux-i386) - CodeGen/X86/vec_compare-2.ll -- failing on Hurd and the other passing, so overall it seems pretty good. (The "$ORIGIN in RPATH" shouldn't matter for the final packages, as RPATH is stripped since the libllvm is in a public library directory.) [1] https://buildd.debian.org/status/fetch.php?pkg=llvm-3.0&arch=hurd-i386&ver=3.0-4&stamp=1323544031 Thanks, -- Pino
--- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -64,6 +64,11 @@ #include <unistd.h> #endif +// For GNU Hurd +#if defined(__GNU__) && !defined(MAXPATHLEN) +# define MAXPATHLEN 4096 +#endif + // Put in a hack for Cygwin which falsely reports that the mkdtemp function // is available when it is not. #ifdef __CYGWIN__ --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -136,7 +136,7 @@ return getgid(); } -#ifdef HAVE_MACH_MACH_H +#if defined(HAVE_MACH_MACH_H) && !defined(__GNU__) #include <mach/mach.h> #endif @@ -150,7 +150,7 @@ setrlimit(RLIMIT_CORE, &rlim); #endif -#ifdef HAVE_MACH_MACH_H +#if defined(HAVE_MACH_MACH_H) && !defined(__GNU__) // Disable crash reporting on Mac OS X 10.0-10.4 // get information about the original set of exception ports for the task --- a/lib/Support/Unix/PathV2.inc +++ b/lib/Support/Unix/PathV2.inc @@ -46,6 +46,11 @@ #include <limits.h> #endif +// For GNU Hurd +#if defined(__GNU__) && !defined(PATH_MAX) +# define PATH_MAX 4096 +#endif + using namespace llvm; namespace { @@ -96,7 +101,11 @@ namespace fs { error_code current_path(SmallVectorImpl<char> &result) { +#ifdef MAXPATHLEN result.reserve(MAXPATHLEN); +#else + result.reserve(1024); +#endif while (true) { if (::getcwd(result.data(), result.capacity()) == 0) { --- a/Makefile.rules +++ b/Makefile.rules @@ -1353,7 +1353,7 @@ endif endif -ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU)) ifneq ($(ARCH), Mips) LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map endif --- a/tools/llvm-shlib/Makefile +++ b/tools/llvm-shlib/Makefile @@ -63,13 +63,13 @@ endif endif -ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU)) # Include everything from the .a's into the shared library. LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ -Wl,--no-whole-archive endif -ifeq ($(HOST_OS),Linux) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU)) # Don't allow unresolved symbols. LLVMLibsOptions += -Wl,--no-undefined endif