Today, the GHC-4.01 from CVS bootstrapped for the first time!
Some small fixes were neccessary:
* RtsAPI uses bits of PrelAddr, but the library order in the
driver is unaware of this. Symptom when linking hsc:
/home/inst/glasgow/linux-4.01-261198/lib/ghc-4.01/libHSrts.a(RtsAPI.o): In
function `rts_mkInt64':
RtsAPI.o(.text+0xb3): undefined reference to `PrelAddr_I64Zh_con_info'
/home/inst/glasgow/linux-4.01-261198/lib/ghc-4.01/libHSrts.a(RtsAPI.o): In
function `rts_mkWord64':
RtsAPI.o(.text+0x163): undefined reference to `PrelAddr_W64Zh_con_info'
Quick Hack: Move libHSrts a little bit to the front. I'm not
sure if this is correct, but at least hsc linked successfully...
* The BSD module has some superfluous commas. Hmm, it seems like
all of the testing has been done on Cygwin only?! :-}
* Added include to avoid some (dangerous?) warnings in module
ByteOps. (I think I've mailed this before...)
* makeForeignObj does not expect a finaliser anymore. Hmm, should
addForeignFinaliser be added to the Foreign module?
Diffs attached.
Ciao,
Sven
diff -r -c fptools.orig/ghc/driver/ghc.lprl fptools/ghc/driver/ghc.lprl
*** fptools.orig/ghc/driver/ghc.lprl Wed Nov 25 09:02:44 1998
--- fptools/ghc/driver/ghc.lprl Thu Nov 26 17:15:43 1998
***************
*** 1223,1228 ****
--- 1223,1231 ----
\begin{code}
sub setupSyslibs {
+ # Push library HSrts, plus boring clib bit
+ push(@SysLibrary, "-lHSrts${BuildTag}");
+
push(@SysLibrary, ( '-lHS', '-lHS_cbits' )); # basic I/O and prelude stuff
local($f);
***************
*** 1230,1238 ****
next if $f =~ /_cbits/;
$f .= $BuildTag if $f =~ /^-lHS/;
}
-
- # Push library HSrts, plus boring clib bit
- push(@SysLibrary, "-lHSrts${BuildTag}");
#
# RTS compiled with cygwin32, uses the WinMM API
--- 1233,1238 ----
diff -r -c fptools.orig/ghc/lib/misc/BSD.lhs fptools/ghc/lib/misc/BSD.lhs
*** fptools.orig/ghc/lib/misc/BSD.lhs Sun Nov 22 18:43:19 1998
--- fptools/ghc/lib/misc/BSD.lhs Thu Nov 26 11:25:09 1998
***************
*** 65,75 ****
NetworkAddr,
NetworkEntry(..)
#ifndef cygwin32_TARGET_OS
! , getNetworkByName, -- :: NetworkName -> IO NetworkEntry
! , getNetworkByAddr, -- :: NetworkAddr -> Family -> IO NetworkEntry
! , setNetworkEntry, -- :: Bool -> IO ()
! , getNetworkEntry, -- :: IO NetworkEntry
! , endNetworkEntry, -- :: IO ()
, getNetworkEntries -- :: Bool -> IO [NetworkEntry]
#endif
--- 65,75 ----
NetworkAddr,
NetworkEntry(..)
#ifndef cygwin32_TARGET_OS
! , getNetworkByName -- :: NetworkName -> IO NetworkEntry
! , getNetworkByAddr -- :: NetworkAddr -> Family -> IO NetworkEntry
! , setNetworkEntry -- :: Bool -> IO ()
! , getNetworkEntry -- :: IO NetworkEntry
! , endNetworkEntry -- :: IO ()
, getNetworkEntries -- :: Bool -> IO [NetworkEntry]
#endif
diff -r -c fptools.orig/ghc/lib/misc/Makefile fptools/ghc/lib/misc/Makefile
*** fptools.orig/ghc/lib/misc/Makefile Tue Sep 29 17:50:13 1998
--- fptools/ghc/lib/misc/Makefile Thu Nov 26 15:20:56 1998
***************
*** 58,63 ****
--- 58,64 ----
Socket_HC_OPTS += -I../std/cbits -optc-DNON_POSIX_SOURCE
SocketPrim_HC_OPTS += -I../std/cbits -H10m -optc-DNON_POSIX_SOURCE
PackedString_HC_OPTS += -H12m
+ ByteOps_HC_OPTS += '-\#include"cbits/ByteOps.h"'
#-----------------------------------------------------------------------------
# Dependency generation
diff -r -c fptools.orig/ghc/lib/misc/SocketPrim.lhs fptools/ghc/lib/misc/SocketPrim.lhs
*** fptools.orig/ghc/lib/misc/SocketPrim.lhs Sun Nov 22 18:42:54 1998
--- fptools/ghc/lib/misc/SocketPrim.lhs Thu Nov 26 15:25:07 1998
***************
*** 85,90 ****
--- 85,91 ----
import PrelIOBase -- IOError, Handle representation
import PrelHandle
import Foreign
+ import PrelWeak ( addForeignFinaliser )
import IO
import IOExts ( IORef, newIORef, readIORef, writeIORef )
***************
*** 1202,1208 ****
socketToHandle (MkSocket fd family stype protocol status) m = do
fo <- _ccall_ openFd fd file_mode flush_on_close
! fo <- makeForeignObj fo (``&freeFileObject'' :: Addr)
mkBuffer__ fo 0 -- not buffered
hndl <- newHandle (Handle__ fo htype NoBuffering socket_str)
return hndl
--- 1203,1210 ----
socketToHandle (MkSocket fd family stype protocol status) m = do
fo <- _ccall_ openFd fd file_mode flush_on_close
! fo <- makeForeignObj fo
! addForeignFinaliser fo (freeFileObject fo)
mkBuffer__ fo 0 -- not buffered
hndl <- newHandle (Handle__ fo htype NoBuffering socket_str)
return hndl
diff -r -c fptools.orig/ghc/lib/posix/PosixIO.lhs fptools/ghc/lib/posix/PosixIO.lhs
*** fptools.orig/ghc/lib/posix/PosixIO.lhs Mon Nov 16 16:58:58 1998
--- fptools/ghc/lib/posix/PosixIO.lhs Thu Nov 26 15:25:43 1998
***************
*** 31,40 ****
import GlaExts
import PrelIOBase
! import PrelHandle (writeHandle, newHandle, getBMode__, getHandleFd )
import IO
import Addr
import Foreign
import CString ( freeze, allocChars, packStringIO, unpackNBytesBAIO )
import PosixUtil
--- 31,41 ----
import GlaExts
import PrelIOBase
! import PrelHandle (writeHandle, newHandle, getBMode__, getHandleFd, freeFileObject,
freeStdFileObject )
import IO
import Addr
import Foreign
+ import PrelWeak ( addForeignFinaliser )
import CString ( freeze, allocChars, packStringIO, unpackNBytesBAIO )
import PosixUtil
***************
*** 111,119 ****
#ifndef __PARALLEL_HASKELL__
fo <-
(if fd == stdInput || fd == stdOutput || fd == stdError then
! makeForeignObj fo (``&freeStdFile''::Addr)
else
! makeForeignObj fo (``&freeFileObject''::Addr))
#endif
(bm, bf_size) <- getBMode__ fo
mkBuffer__ fo bf_size
--- 112,124 ----
#ifndef __PARALLEL_HASKELL__
fo <-
(if fd == stdInput || fd == stdOutput || fd == stdError then
! do fo <- makeForeignObj fo
! addForeignFinaliser fo (freeStdFileObject fo)
! return fo
else
! do fo <- makeForeignObj fo
! addForeignFinaliser fo (freeFileObject fo)
! return fo)
#endif
(bm, bf_size) <- getBMode__ fo
mkBuffer__ fo bf_size