gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: GCL on OpenBSD: estack_buf missing


From: Magnus Henoch
Subject: [Gcl-devel] Re: GCL on OpenBSD: estack_buf missing
Date: Sun, 01 Feb 2004 16:21:19 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Camm Maguire <address@hidden> writes:

> Greetings!  Could you please try with the latest cvs stable and/or
> development branches via
>
> export CVS_RSH=ssh
> export CVSROOT=:ext:address@hidden:/cvsroot/gcl
> cvs -z9 -q co gcl (for unstable)
> cvs -z9 -q co -r Version_2_6_1 -d gcl-2.6.1 gcl (for stable)
>
> GCL, at least CVS head if memory serves, is known to work (I think out
> of the box) on FreeBSD.  I have some pending suggestions from the
> FreeBSD maintainer yet to integrate.  He reports success with GCL in
> maxima and axiom.  I'm cc'ing him above.

I tried CVS head, and received the same error.

I looked at the CVS history for h/FreeBSD.h, and found that exactly
the same problem had already been fixed there.  I applied the diff
between 1.1 and 1.2 and proceeded.  (it seems that this should be done
for h/NetBSD.h as well)

Then, I found that OpenBSD does not have isnormal.  I crudely hacked
the following and proceeded:

Index: h/gclincl.h.in
===================================================================
RCS file: /cvsroot/gcl/gcl/h/gclincl.h.in,v
retrieving revision 1.31
diff -u -r1.31 gclincl.h.in
--- h/gclincl.h.in      16 Jan 2004 16:56:54 -0000      1.31
+++ h/gclincl.h.in      30 Jan 2004 20:12:48 -0000
@@ -124,7 +124,9 @@
 #include <ieeefp.h>
 #define ISNORMAL(a) (fpclass(a)>=FP_NZERO)
 #else
-#error "No isnormal found"
+/* special case for OpenBSD */
+#include <math.h>
+#define ISNORMAL(a) (finite(a) && (a) != 0.0)
 #endif
 #endif
 #endif

gcc complained about mismatching prototypes:

Index: o/sfasl.c
===================================================================
RCS file: /cvsroot/gcl/gcl/o/sfasl.c,v
retrieving revision 1.16
diff -u -r1.16 sfasl.c
--- o/sfasl.c   28 Jan 2004 07:21:52 -0000      1.16
+++ o/sfasl.c   30 Jan 2004 20:12:58 -0000
@@ -48,7 +48,7 @@
 int node_compare();
 #ifndef _WIN32
 void *malloc();
-char *bsearch();
+void *bsearch();
 #endif
 
 struct reloc relocation_info;
Index: unixport/rsym.c
===================================================================
RCS file: /cvsroot/gcl/gcl/unixport/rsym.c,v
retrieving revision 1.2
diff -u -r1.2 rsym.c
--- unixport/rsym.c     25 Jul 2002 21:49:47 -0000      1.2
+++ unixport/rsym.c     30 Jan 2004 20:12:58 -0000
@@ -59,9 +59,10 @@
 them out to a file together with their addresses */
 static char *outfile;
 
-main(argc,argv)
+main(argc,argv,envp)
 int argc ;
 char *argv[];
+char *envp[];
 {
   if (argc!=3) {perror("bad arg count");
                fflush(stdout);
@@ -80,7 +81,7 @@
        unsigned int i;
        FILE *fp;
        int string_size=0;
-       extern char *malloc();
+       extern void *malloc();
         
        fp = fopen(filename, RDONLY);
        
Then, I stumbled upon the following:

gcc -pipe -O2 -fwritable-strings -fomit-frame-pointer -DVOL=volatile 
-I/home/magnus/noarchive/src/gcl/o -I/usr/local/lib/gcl-2.3/h -I../h 
-I/usr/local/include -I/usr/local/include/tk8.0 -I/usr/local/include/tcl8.0 
-I/usr/X11R6/include -fsigned-char -L/usr/local/lib -L/usr/X11R6/lib -Wall 
-DVOL=volatile -fsigned-char -fwritable-strings -pipe -O3 -fomit-frame-pointer  
-I/home/magnus/noarchive/src/gcl/o -I../h -I../o -o rsym rsym.c
rsym.c:63: warning: return-type defaults to `int'
rsym.c: In function `main':
rsym.c:73: warning: implicit declaration of function `get_myself'
rsym.c:74: warning: implicit declaration of function `output_externals'
rsym.c: At top level:
rsym.c:79: warning: return-type defaults to `int'
rsym.c: In function `get_myself':
rsym.c:169: warning: control reaches end of non-void function
rsym.c: At top level:
rsym.c:175: warning: return-type defaults to `int'
../h/ptable.h:53: storage size of `link_info' isn't known
gmake[1]: *** [rsym] Error 1
gmake[1]: Leaving directory `/home/magnus/noarchive/src/gcl/unixport'
gmake: *** [unixport/saved_pre_gcl] Error 2

link_info is of type bfd_link_info, which is defined in bfdlink.h.
Thus the following:

Index: h/ptable.h
===================================================================
RCS file: /cvsroot/gcl/gcl/h/ptable.h,v
retrieving revision 1.5
diff -u -r1.5 ptable.h
--- h/ptable.h  4 Aug 2003 23:40:24 -0000       1.5
+++ h/ptable.h  30 Jan 2004 20:55:44 -0000
@@ -50,6 +50,8 @@
 #ifdef SPECIAL_RSYM
 struct string_address_table c_table;
 #else
+#include <bfd.h>
+#include <bfdlink.h>
 struct bfd_link_info link_info;
 #endif
 struct string_address_table combined_table;

I also needed the following:

Index: unixport/makefile
===================================================================
RCS file: /cvsroot/gcl/gcl/unixport/makefile,v
retrieving revision 1.51
diff -u -r1.51 makefile
--- unixport/makefile   2 Dec 2003 20:16:56 -0000       1.51
+++ unixport/makefile   1 Feb 2004 14:20:37 -0000
@@ -14,7 +14,7 @@
 PORTDIR = $(shell pwd)
 
 LD_LIBS_PRE=$(addprefix -u ,$(PATCHED_SYMBOLS))
-LD_LIBS_POST=$(LIBS) $(LIBC) -lgclp
+LD_LIBS_POST=$(LIBS) $(LIBC) -lgclp -lbfd -liberty -lreadline -lncurses
 
 ifeq ($(ARRS),)
 ARRS:=ar rs

And, as SEEK_TO_END_OFILE was not defined but referenced, I copied a
piece of sfasl.c into sfaslbfd.c:

Index: o/sfaslbfd.c
===================================================================
RCS file: /cvsroot/gcl/gcl/o/sfaslbfd.c,v
retrieving revision 1.13
diff -u -r1.13 sfaslbfd.c
--- o/sfaslbfd.c        6 Aug 2003 17:03:40 -0000       1.13
+++ o/sfaslbfd.c        1 Feb 2004 14:20:37 -0000
@@ -337,7 +337,17 @@
 
   /* Find a way of doing this in bfd -- use this for now.  Unfortunately, 
      we're not always at file end after reading in the sections -- CM */
-  SEEK_TO_END_OFILE(dum.sm.sm_fp);
+  /*  SEEK_TO_END_OFILE(dum.sm.sm_fp);*/
+#ifdef SEEK_TO_END_OFILE
+        SEEK_TO_END_OFILE(dum.sm.sm_fp);       
+#else
+       {
+         int i;
+        /* go past any zeroes */
+         while ( ( i = getc ( dum.sm.sm_fp ) ) == 0 );
+         ungetc(i, dum.sm.sm_fp);
+       }
+#endif
 
   if (feof(dum.sm.sm_fp))
     data=0;

And finally the following happened, which I do not understand at all:

gmake[1]: Entering directory `/home/magnus/noarchive/src/gcl/unixport'
gcc -pipe -O2 -fwritable-strings -fomit-frame-pointer -DVOL=volatile 
-I/home/magnus/noarchive/src/gcl/o -I/usr/local/lib/gcl-2.3/h -I../h 
-I/usr/local/include -I/usr/local/include/tk8.0 -I/usr/local/include/tcl8.0 
-I/usr/X11R6/include -fsigned-char -L/usr/local/lib -L/usr/X11R6/lib -o 
raw_pre_gcl  \
        -L.   -lpre_gcl -lm -ltk80 -ltcl80 -lX11 -lXt -lc -lgclp -lbfd -liberty 
-lreadline -lncurses
/usr/local/lib/libtcl80.so.1.5: warning: tmpnam() possibly used unsafely; 
consider using mkstemp()
cat init_pre_gcl.lsp.tmp | sed \
        -e "s,@LI-VERS@,(`cat ../majvers`.`cat ../minvers`) `date`,1" \
        -e "s,@LI-MINVERS@,`cat ../minvers`,1" \
        -e "s,@LI-MAJVERS@,`cat ../majvers`,1" \
        -e "s/@LI-CC@/\"gcc -pipe -O2 -fwritable-strings -fomit-frame-pointer 
-DVOL=volatile -I/home/magnus/noarchive/src/gcl/o -I/usr/local/lib/gcl-2.3/h 
-I../h -I/usr/local/include -I/usr/local/include/tk8.0 
-I/usr/local/include/tcl8.0 -I/usr/X11R6/include -fsigned-char -L/usr/local/lib 
-L/usr/X11R6/lib -c -Wall -DVOL=volatile -fsigned-char -fwritable-strings -pipe 
\"/1" \
        -e "s,@LI-LD@,\"gcc -pipe -O2 -fwritable-strings -fomit-frame-pointer 
-DVOL=volatile -I/home/magnus/noarchive/src/gcl/o -I/usr/local/lib/gcl-2.3/h 
-I../h -I/usr/local/include -I/usr/local/include/tk8.0 
-I/usr/local/include/tcl8.0 -I/usr/X11R6/include -fsigned-char -L/usr/local/lib 
-L/usr/X11R6/lib -o \",1" \
        -e "s,@LI-LD-LIBS@,\" -lpre_gcl -lm -ltk80 -ltcl80 -lX11 -lXt -lc 
-lgclp -lbfd -liberty -lreadline -lncurses\",1" \
        -e "s,@LI-OPT-THREE@,\"-O3 -fomit-frame-pointer\",1" \
        -e "s,@LI-OPT-TWO@,\"-O\",1" \
        -e "s,@LI-INIT-LSP@,\"init_pre_gcl.lsp\",1" >init_pre_gcl.lsp
sed: 1: "s,@LI-MINVERS@,7.0,1": bad flag in substitute command: 'u'
gmake[1]: *** [init_pre_gcl.lsp] Error 1
rm raw_pre_gcl init_pre_gcl.lsp
gmake[1]: Leaving directory `/home/magnus/noarchive/src/gcl/unixport'
gmake: *** [unixport/saved_pre_gcl] Error 2

I don't see any 'u' flag there.

sed in this case is OpenBSD sed, not GNU sed.  GNU sed also fails,
with this message:

sed: -e expression #4, char 84: Unknown option to `s'

All in all, does this patching of mine make any sense?  Is this simply
a matter of the OpenBSD port not having been kept up to date with
other changes (which was clearly the case with OpenBSD.h) - in which
case my patches could be polished, generalized and included in the
configure scripts - or am I missing something fundamental?

Additional data points:  OpenBSD 3.4 is the first version where the
i386 arch uses ELF instead of a.out (some other architectures were
earlier).  gcc is 'gcc version 2.95.3 20010125 (prerelease,
propolice)'.

Thanks for any advice,
Magnus





reply via email to

[Prev in Thread] Current Thread [Next in Thread]