retitle 567298 ghc6: FTBFS on kfreebsd-i386 (small fixes needed for GHCi)
tags 567298 +patch
--
Hi,
please apply attached patch, it includes also
kfreebsd-_gnu_source-565818, so please apply instead of.
It enables ghci, as a side effect it solves the FTBFS on kfreebsd-i386.
Petr
diff -ur bd/driver/mangler/ghc-asm.lprl lx/driver/mangler/ghc-asm.lprl
--- bd/driver/mangler/ghc-asm.lprl 2009-12-10 19:11:33.000000000 +0100
+++ lx/driver/mangler/ghc-asm.lprl 2010-01-22 09:06:40.000000000 +0100
@@ -216,7 +216,7 @@
$T_HDR_vector = "\.text\n\t\.align 8\n";
#--------------------------------------------------------#
- } elsif ( $TargetPlatform =~ /^x86_64-.*-(linux|openbsd|freebsd|dragonfly|netbsd)$/m ) {
+ } elsif ( $TargetPlatform =~ /^x86_64-.*-(linux|openbsd|freebsd|dragonfly|netbsd|kfreebsdgnu)$/m ) {
$T_STABBY = 0; # 1 iff .stab things (usually if a.out format)
$T_US = ''; # _ if symbols have an underscore on the front
diff -ur bd/rts/Linker.c lx/rts/Linker.c
--- bd/rts/Linker.c 2009-12-10 19:11:33.000000000 +0100
+++ lx/rts/Linker.c 2010-01-22 09:09:21.000000000 +0100
@@ -13,8 +13,8 @@
/* Linux needs _GNU_SOURCE to get RTLD_DEFAULT from <dlfcn.h> and
MREMAP_MAYMOVE from <sys/mman.h>.
*/
-#ifdef __linux__
-#define _GNU_SOURCE
+#if defined(__linux__) || defined(__GLIBC__)
+#define _GNU_SOURCE 1
#endif
#include "Rts.h"
@@ -63,12 +63,12 @@
#include <sys/wait.h>
#endif
-#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
#define USE_MMAP
#include <fcntl.h>
#include <sys/mman.h>
-#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -76,7 +76,7 @@
#endif
-#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
# define OBJFORMAT_ELF
#elif defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
# define OBJFORMAT_PEi386
@@ -1410,7 +1410,7 @@
} else {
if ((W_)result > 0x80000000) {
// oops, we were given memory over 2Gb
-#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
+#if defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS)
// Some platforms require MAP_FIXED. This is normally
// a bad idea, because MAP_FIXED will overwrite
// existing mappings.
diff -ur bd/rts/posix/OSThreads.c lx/rts/posix/OSThreads.c
--- bd/rts/posix/OSThreads.c 2009-12-10 19:11:32.000000000 +0100
+++ lx/rts/posix/OSThreads.c 2010-01-22 09:03:26.000000000 +0100
@@ -7,10 +7,10 @@
*
* --------------------------------------------------------------------------*/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
/* We want GNU extensions in DEBUG mode for mutex error checking */
/* We also want the affinity API, which requires _GNU_SOURCE */
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
#endif
#include "PosixSource.h"
diff -ur bd/mk/config.mk.in lx/mk/config.mk.in
--- bd/mk/config.mk.in 2009-12-10 19:11:33.000000000 +0100
+++ lx/mk/config.mk.in 2010-01-28 14:03:13.000000000 +0100
@@ -153,7 +153,7 @@
# Whether to include GHCi in the compiler. Depends on whether the RTS linker
# has support for this OS/ARCH combination.
-OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin)))
+OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux kfreebsdgnu solaris2 freebsd dragonfly netbsd openbsd darwin)))
ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc sparc64)))
ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"