These patches get gcl-2.1 to work on my Linux ELF system (which
currently has gcc-2.7.0 and libc-5.2.4, but the patches will probably
work with any Linux ELF system).

The patches fix several bugs in gcl in addition to making the
necessary changes specific to Linux.  The patches include the
following changes:

1) PAGEWIDTH is defined to correspond to 4 kbytes.

2) MAXPAGE is set to a value corresponding to 8 Mbytes.

3) At one stage I found it necessary to have a script "cc-lsp-linux"
   in order to allow gcl to compile a C source file to an a.out
   format object file.  To invoke this I needed to create a makefile
   string CCLSP in addition to the CC string.  I have retained this
   distinction, even though it is no longer strictly needed for my
   purposes.

4) The file mp/mpi-386d.s has been replaced by mp/mpi-386d.S, which
   is essentially the same thing but in a form which is compatible with
   both a.out and ELF.

5) The gcl malloc() interferes with the requirements of the startup
   routines under Linux.  A small change to o/gbc.c works around this
   problem.

6) A small obvious change to o/grab_defs.c (which was also noticed by
   other users and posted to the gcl mailing list).

7) Some Makefile changes because I don't include "." in my PATH.

8) A lot of the ELF code in gcl assumes that there is some order in
   the sections of an ELF file.  This is wrong; apart from the position
   of the ELF header, there is no guaranteed order for the sections of
   an ELF file.  I made the changes necessary for Linux.
   The unexec-19.27.c which is included in gcl-2.1 is broken in this
   respect (although it will work on systems where the ELF files do
   have an extra imposed order).  I made changes to it (actually, I
   made changes to the unexelf.c from emacs-19.28) and then I
   subsequently found out that RMS had essentially identical changes
   prepared for emacs-19.29.  The version which I include with these
   patches is taken from emacs-19.29, with the minor change needed for
   gcl applied.

9) A nasty little bug occurs in the startup code which comes with Linux
   libc versions around 5.2.0-5.2.3.  The first call to sbrk() always
   returns an error.  gcl makes an sbrk(0) call but does not check
   the returned value and this leads to a subtle bug much later when
   GBC() is called.  This problem is avoided by making a preliminary
   call to sbrk().  sbrk() is fixed in libc-5.2.4

10) Several calls to FEerror() were incorrectly passing an (int) rather
   than an (object).  Code to convert the int to an object has been
   added where required.

11) memprotect_handler() was modifying one of its non-standard arguments.
   This corrupted the saved registers on the stack under Linux, causing
   a fatal error.


The patches have been made w.r.t. a standard gcl-2.1 distribution.
To apply the patches, simply run the "install-patch-wm" script included
with the patches.



Bill Metzenthen  <billm@jacobi.maths.monash.edu.au>
5 August 1995
