From: sewardj Date: Fri, 29 Oct 1999 11:41:12 +0000 (+0000) Subject: [project @ 1999-10-29 11:41:04 by sewardj] X-Git-Tag: Approximately_9120_patches~5646 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d2ae51efe07db4d7c003ca90a96fa8578c5c8566;p=ghc-hetmet.git [project @ 1999-10-29 11:41:04 by sewardj] Basic #ifdeffery to make StgHugs compile out of the box on cygwin. --- diff --git a/ghc/interpreter/Makefile b/ghc/interpreter/Makefile index b82c13d..5fe682a 100644 --- a/ghc/interpreter/Makefile +++ b/ghc/interpreter/Makefile @@ -1,6 +1,6 @@ # ----------------------------------------------------------------------------- # -# $Id: Makefile,v 1.11 1999/10/15 11:02:09 sewardj Exp $ # +# $Id: Makefile,v 1.12 1999/10/29 11:41:04 sewardj Exp $ # # ----------------------------------------------------------------------------- # TOP = ../.. @@ -13,6 +13,12 @@ RTS_DIR = $(TOP)/ghc/rts # interpreter and relevant .a/.so files # # --------------------------------------------------------------------- # +ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32" +DYN_EXT=.dll +else +DYN_EXT=.so +endif + YACC = bison -y %.c: %.y -$(YACC) $< @@ -31,16 +37,22 @@ SRC_CC_OPTS = -g -O -I$(GHC_DIR)/interpreter -I$(GHC_DIR)/includes -I$(GHC_DIR)/ GHC_LIBS_NEEDED = $(TOP)/ghc/rts/libHSrts.a -all :: parser.c $(GHC_LIBS_NEEDED) nHandle.so hugs +all :: parser.c $(GHC_LIBS_NEEDED) nHandle.$(DYN_EXT) hugs ### EXTREMELY hacky hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o \ ../rts/Evaluator.o ../rts/ForeignCall.o ../rts/GC.o ../rts/Printer.o \ - ../rts/StgCRun.o nHandle.so - $(CC) -o $@ -rdynamic $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -ldl -lm + ../rts/StgCRun.o + $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -lm + -nHandle.so: nHandle.c - gcc -O -fPIC -shared -o nHandle.so nHandle.c +nHandle.$(DYN_EXT): nHandle.c +ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32" + gcc -O -Wall -o nHandle.o -c nHandle.c + dllwrap -o nHandle.dll nHandle.o +else + gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c +endif $(TOP)/ghc/rts/libHSrts.a: (cd $(TOP)/ghc/rts ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_DIR)/interpreter) @@ -78,7 +90,7 @@ checkrun: all # Cleanery & misc # # --------------------------------------------------------------------- # -CLEAN_FILES += hugs nHandle.so +CLEAN_FILES += hugs nHandle.dll CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o CLEAN_FILES += parser.c diff --git a/ghc/interpreter/connect.h b/ghc/interpreter/connect.h index 426d84c..06a2983 100644 --- a/ghc/interpreter/connect.h +++ b/ghc/interpreter/connect.h @@ -8,8 +8,8 @@ * included in the distribution. * * $RCSfile: connect.h,v $ - * $Revision: 1.13 $ - * $Date: 1999/10/26 17:27:41 $ + * $Revision: 1.14 $ + * $Date: 1999/10/29 11:41:04 $ * ------------------------------------------------------------------------*/ /* -------------------------------------------------------------------------- @@ -238,6 +238,7 @@ extern Void addTupInst Args((Class,Int)); extern Inst addRecShowInst Args((Class,Ext)); extern Inst addRecEqInst Args((Class,Ext)); #endif +extern List typeVarsIn Args((Cell,List,List,List)); extern List oclose Args((List,List)); extern List zonkTyvarsIn Args((Type,List)); extern Type zonkTyvar Args((Int)); diff --git a/ghc/interpreter/interface.c b/ghc/interpreter/interface.c index 0a98143..78dbd3c 100644 --- a/ghc/interpreter/interface.c +++ b/ghc/interpreter/interface.c @@ -7,8 +7,8 @@ * Hugs version 1.4, December 1997 * * $RCSfile: interface.c,v $ - * $Revision: 1.5 $ - * $Date: 1999/07/06 15:24:38 $ + * $Revision: 1.6 $ + * $Date: 1999/10/29 11:41:04 $ * ------------------------------------------------------------------------*/ /* ToDo: @@ -31,7 +31,7 @@ #include "connect.h" #include "errors.h" #include "link.h" -#include "Assembler.h" /* for wrapping GHC objects */ +#include "Assembler.h" /* for wrapping GHC objects */ #include "dynamic.h" #define DEBUG_IFACE @@ -1059,7 +1059,8 @@ List ktyvars; { /* [(VarId|Text,Kind)] */ fprintf(stderr,"\n"); assert(0); } - assert(0); /* NOTREACHED */ + assert(0); + return NIL; /* NOTREACHED */ } @@ -1086,7 +1087,7 @@ Type type; { Text m = qmodOf(type); Text v = qtextOf(type); Module mod = findModule(m); -printf ( "lookup qualident " ); print(type,100); printf("\n"); + //printf ( "lookup qualident " ); print(type,100); printf("\n"); if (isNull(mod)) { ERRMSG(line) "Undefined module in qualified name \"%s\"", @@ -1136,7 +1137,8 @@ printf ( "lookup qualident " ); print(type,100); printf("\n"); fprintf(stderr,"\n"); assert(0); } - assert(0); /* NOTREACHED */ + assert(0); + return NIL; /* NOTREACHED */ } @@ -1201,7 +1203,7 @@ Type type; { static List local ifTyvarsIn(type) Type type; { - List vs = typeVarsIn(type,NIL,NIL); + List vs = typeVarsIn(type,NIL,NIL,NIL); List vs2 = vs; for (; nonNull(vs2); vs2=tl(vs2)) { Cell v = hd(vs2); @@ -1219,6 +1221,8 @@ Type type; { * ELF specifics * ------------------------------------------------------------------------*/ +#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) + #include static char* local findElfSection ( void* objImage, Elf32_Word sh_type ) @@ -1548,6 +1552,8 @@ static void readSyms_elf ( Module m ) } } +#endif /* defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) */ + /* -------------------------------------------------------------------------- * Arch-independent interface to the runtime linker @@ -1555,20 +1561,32 @@ static void readSyms_elf ( Module m ) static Bool local validateOImage ( void* img, Int size, Bool verb ) { +#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) return validateOImage_elf ( img, size, verb ); +#else + internal("validateOImage: not implemented on this platform"); +#endif } static Void local resolveReferencesInObjectModule ( Module m, Bool verb ) { +#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) resolveReferencesInObjectModule_elf ( m, verb ); +#else + internal("resolveReferencesInObjectModule: not implemented on this platform"); +#endif } static Void local readSyms ( Module m ) { +#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) readSyms_elf ( m ); +#else + internal("readSyms: not implemented on this platform"); +#endif } diff --git a/ghc/interpreter/nHandle.c b/ghc/interpreter/nHandle.c index 063bc79..4076c3f 100644 --- a/ghc/interpreter/nHandle.c +++ b/ghc/interpreter/nHandle.c @@ -93,15 +93,4 @@ int nh_getenv ( int p ) return (int)getenv ( (const char *)p ); } -extern int prog_argc; -extern char** prog_argv; -int nh_argc ( void ) -{ - return prog_argc; -} - -int nh_argvb ( int argno, int offset ) -{ - return (int)(prog_argv[argno][offset]); -} diff --git a/ghc/interpreter/static.c b/ghc/interpreter/static.c index 7a61668..d195831 100644 --- a/ghc/interpreter/static.c +++ b/ghc/interpreter/static.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: static.c,v $ - * $Revision: 1.13 $ - * $Date: 1999/10/26 17:27:45 $ + * $Revision: 1.14 $ + * $Date: 1999/10/29 11:41:05 $ * ------------------------------------------------------------------------*/ #include "prelude.h" @@ -65,7 +65,6 @@ static List local classBindings Args((String,Class,List)); static Name local memberName Args((Class,Text)); static List local numInsert Args((Int,Cell,List)); - List local typeVarsIn Args((Cell,List,List,List)); static List local maybeAppendVar Args((Cell,List)); static Type local checkSigType Args((Int,String,Cell,Type)); diff --git a/ghc/rts/universal_call_c.S b/ghc/rts/universal_call_c.S index 6b70dab..928c1bc 100644 --- a/ghc/rts/universal_call_c.S +++ b/ghc/rts/universal_call_c.S @@ -5,8 +5,8 @@ * Copyright (c) 1994-1999. * * $RCSfile: universal_call_c.S,v $ - * $Revision: 1.7 $ - * $Date: 1999/10/27 15:29:37 $ + * $Revision: 1.8 $ + * $Date: 1999/10/29 11:41:12 $ * ------------------------------------------------------------------------*/ #include "config.h" @@ -64,7 +64,13 @@ } } #endif - + +#if LEADING_UNDERSCORE +#define ADD_UNDERSCORE(sss) _##sss +#else +#define ADD_UNDERSCORE(sss) sss +#endif + #if i386_TARGET_ARCH /* @@ -72,8 +78,8 @@ * *and* assumes that I myself was called using ccall. */ -.globl universal_call_c_x86_ccall -universal_call_c_x86_ccall: +.globl ADD_UNDERSCORE(universal_call_c_x86_ccall) +ADD_UNDERSCORE(universal_call_c_x86_ccall): pushl %ebp movl %esp,%ebp pushl %edi @@ -148,8 +154,8 @@ universal_call_c_x86_ccall: # stdcall convention, *but* assumes that I myself was called # using ccall. -.globl universal_call_c_x86_stdcall -universal_call_c_x86_stdcall: +.globl ADD_UNDERSCORE(universal_call_c_x86_stdcall) +ADD_UNDERSCORE(universal_call_c_x86_stdcall): pushl %ebp movl %esp,%ebp pushl %edi