From jan@swi.psy.uva.nl Fri Sep 24 16:21:46 1999 Received: from gollem.swi.psy.uva.nl (jan@gollem [145.18.114.15]) by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id QAA21262 for ; Fri, 24 Sep 1999 16:21:46 +0200 (MET DST) Received: from localhost (localhost [[UNIX: localhost]]) by gollem.swi.psy.uva.nl (8.8.8/8.8.8) id QAA02397; Fri, 24 Sep 1999 16:22:37 +0200 From: Jan Wielemaker To: prolog@swi.psy.uva.nl, Johan van Rijn Subject: Re: Problems whith porting Prolog on SGI platform Date: Fri, 24 Sep 1999 16:17:47 +0200 X-Mailer: KMail [version 0.7.9] Content-Type: text/plain References: <37E8EB94.8C357DB4@nlr.nl> MIME-Version: 1.0 Message-Id: <99092416223700.31496@gollem> Content-Transfer-Encoding: 8bit On Wed, 22 Sep 1999, Johan van Rijn wrote: >I seem to have problems whith porting prolog on a SGI Indy or O2. > >It does not matter if use gmake or make, both endup with: > >ar x `gcc -print-libgcc-file-name` frame.o >gcc -c -I. -I. -I./rc -Wall -O2 pl-main.c -o pl-main.o >gcc -c -I. -I. -I./rc -Wall -O2 pl-extend.c -o pl-extend.o >gcc -export-dynamic -o pl -Lrc pl-atom.o pl-wam.o pl-stream.o >pl-error.o pl-arith.o pl-bag.o pl-comp.o pl-rc.o pl-dwim.o pl-ext.o >pl-file.o pl-flag.o pl-fmt.o pl-funct.o pl-gc.o pl-glob.o pl-itf.o >pl-list.o pl-load.o pl-modul.o pl-op.o pl-os.o pl-prims.o pl-pro.o >pl-proc.o pl-prof.o pl-read.o pl-rec.o pl-rl.o pl-setup.o pl-sys.o >pl-table.o pl-trace.o pl-util.o pl-wic.o pl-write.o pl-term.o >pl-buffer.o pl-thread.o frame.o pl-main.o pl-extend.o -lrc -ldl >-ltermcap -lm >ld32: WARNING 1: Unknown option: export-dynamic (ignored). >ld32: WARNING 84: /usr/lib32/libdl.so is not used for resolving any >symbol. >./pl -O -o pl.prc -b ../boot/init.pl >gmake: *** [pl.prc] Bus error (core dumped) After an off-mailinglist exchange with Johan, these problems problems have been identified. They probably affect a number of machines based on RISC processors. Whether you are in danger depends on various details. If you haven't had bus errors, you are likely ok. If you did have them, please try the patches below --- Jan Index: pl-wam.c =================================================================== RCS file: /usr/local/cvsroot/pl/src/pl-wam.c,v retrieving revision 1.85 diff -u -w -r1.85 pl-wam.c --- pl-wam.c 1999/07/19 13:29:47 1.85 +++ pl-wam.c 1999/09/23 13:38:38 @@ -959,6 +959,14 @@ Sdprintf("PL_open_query in unitialized environment.\n"); }); + /* should be struct alignment, */ + /* but for now, I think this */ + /* is always the same */ +#ifdef DOUBLE_ALIGNMENT + while ( (ulong)lTop % DOUBLE_ALIGNMENT ) + lTop = addPointer(lTop, sizeof(word)); +#endif + qf = (QueryFrame) lTop; fr = &qf->frame; def = proc->definition; Index: pl-os.c =================================================================== RCS file: /usr/local/cvsroot/pl/src/pl-os.c,v retrieving revision 1.109 diff -u -w -r1.109 pl-os.c --- pl-os.c 1999/09/14 11:10:47 1.109 +++ pl-os.c 1999/09/23 08:37:01 @@ -1096,8 +1096,13 @@ } } + /* we need to use malloc() here */ + /* because allocHeap() only ensures */ + /* alignment for `word', and inode_t */ + /* is sometimes bigger! */ + if ( statfunc(OsPath(path, tmp), &buf) == 0 ) - { CanonicalDir dn = allocHeap(sizeof(struct canonical_dir)); + { CanonicalDir dn = malloc(sizeof(struct canonical_dir)); char dirname[MAXPATHLEN]; char *e = path + strlen(path); @@ -1126,6 +1131,7 @@ strcat(dirname, e); strcpy(path, dirname); dn->canonical = store_string(path); + canonical_dirlist = dn; DEBUG(1, Sdprintf("(replace) %s\n", path)); return path; }