gcl-devel
[Top][All Lists]
Advanced

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

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


From: Camm Maguire
Subject: Re: [Gcl-devel] Re: GCL on OpenBSD: estack_buf missing
Date: 02 Feb 2004 11:45:13 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings, and thanks for your report!  We now have known users for
each of the three BSD varieties!  Unfortunately there is somewhat of
a challenge at present keeping all three in sync.  I will endeavor in
the next few days to go through Mark Murray's remaining patch
submissions, in which he greatly simplifies things by centralizing
shared unix config settings in the linux.h file.  At that point, I'd
greatly appreciate a volunteer from each BSD to sign on as a GCL
developer, and take responsibility for maintaining the appropriate .h
and .defs files.  From there, I'd like to begin shrinking and
eventually eliminating these files via an expanded configure script. 

Perhaps you or someone you know would like to volunteer?  In any case,
at present our best supported bsd is freebsd, so I'd suggest you try
./configure --enable-machine=freebsd and report differences from
there.

Comments below.

Magnus Henoch <address@hidden> writes:

> 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)
> 

Yes, we should centralize common code in a common file I think.  See
comments above. 

> 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)

Zero is not normal?  In any case, I think Mark had a BSD equivalent,
which I'd be happy to put in as an #ifdef case after the HAVE_IEEE if
someone could contribute a configure test for it.

>  #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
>  

This is correct, and I'll apply, thanks!  But your build should not be
getting here if you are using, as recommended, either the
--enable-statsysbfd relocation option to configure, or the
--disable-statsysbfd --enable-custreloc options (or even
--disable-statsysbfd --enable-locbfd if you can't have your own bfd
library).  I think Mark got both to work.  I.e. you should have
defined SEPARATE_SFASL_FILE.  If you use some bfd, you will not be
compiling the rsym utility.  What appears to have happened below is
that you are compiling rsym when your GCL is set to use bfd.  Here is
the relevant section you need in the .defs file:

RSYM    = rsym
ifneq ($(findstring bfd,$(LIBS)),) 
RSYM    = 
endif
SFASL   = $(ODIR)/sfasl.o

Again, I'd recommend starting with the freebsd settings.

>  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>

These should have been included in gclincl.h by configure if it found
them.  If not, please post your full configure and build output.

>  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
>  

Same issue as above.

>  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

I'm not certain this will work.  What's wrong with the versions in
linux.h or FreeBSD.h?

>  
>    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 my experience is with gnu sed, and I've never seen this.  Is
something truncating the command after a certain number of chars?
What sed version?  In any case, you can just make the substitutions in
this file by hand at first if you want to test your build.

> 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?
> 

Yes, this is simply bitrot in the openbsd files, as no one has
reported using them.  It would be great to simplify and support each
of the bsd's out of the box.  I'm certainly willing to commit changes
to this end.

> 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)'.
> 

You may have difficulties with propolice -- I'd suggest turning it off
initially. 

Take care,

> Thanks for any advice,
> Magnus
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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