NetBSD/gnu/dist/gcc/README.g77

171 lines
8.7 KiB
Plaintext

1997-06-20
This directory contains the version 0.5.21 release of the GNU Fortran
compiler. The GNU Fortran compiler is free software. See the file
COPYING.g77 for copying permission.
* IMPORTANT: Things you _must_ do are marked with a * at the beginning of
the line in this file!!!
This README is for GNU Fortran, and describes the files in the f/
directory. The f/ directory is intended to be a subdirectory of a
gcc source tree. These directories are referred to below as gcc/,
which is the top-level directory containing the gcc back end, the
gcc C front end, and other non-Fortran files, and gcc/f/, which
contains all of the Fortran files.
* Note, if this is an egcs release, all the installation information
which follows is not needed. It is provided for historical reference
only.
* To build GNU Fortran, you must have a source distribution of gcc
version 2.7.2.2. Do not attempt to use any other version
of gcc, because this version of g77 is designed to work only with
gcc version 2.7.2.2.
* Note that you must have source copies of these gcc distributions!!
You cannot build g77 just using binaries of gcc. Also, unless you
are an expert, avoid using any distribution of gcc not identical to
the one distributed by the FSF -- for example, using a special version
modified to produce better code for the Pentium (sometimes labeled
gcc-i2.6.3 -- note the `i') will not work with this distribution of g77.
If you have just unpacked the g77 distribution, before proceeding,
you must merge the contents of the g77 distribution with the appropriate
gcc distribution on your system before proceeding.
* Read and follow the instructions in g77-0.5.21/f/INSTALL that
explain how to merge a g77 source directory into a gcc source
directory. You can use Info to read the same installation
instructions via:
info -f g77-0.5.21/f/g77.info -n Unpacking
The resulting directory layout includes the following, where gcc/ might be
a link to, for example, gcc-2.7.2.2/:
gcc/ Non-Fortran files in gcc (not part of g77*.tar)
gcc/README.g77 This file
gcc/f/ GNU Fortran front end
gcc/f/gbe/ Patches required for gcc back end versions
gcc/f/runtime/ libf2c configuration and f2c.h file generation
gcc/f/runtime/libF77/ Non-I/O portion of libf2c
gcc/f/runtime/libI77/ I/O portion of libf2c
gcc/f/runtime/libU77/ Additional interfaces to libc for libf2c
gcc/f/ as a whole contains the program GNU Fortran (g77), plus a portion
of the separate program f2c, which is in gcc/f/runtime. NOTE: The f2c
code is not part of the program g77, just distributed with it.
This directory is named gcc/f/ because it, along with its contents, is
designed to be a subdirectory of a GNU CC (gcc) development directory. I.e.
when a gcc distribution is unpacked into a directory (named gcc/ for
example), it typically contains subdirectories like gcc/config/ and
gcc/cp/. The latter is the subdirectory for the GNU C++ (g++) program.
Similarly, the g77 directory f/ is designed to be placed in gcc/ so that
it becomes the subdirectory gcc/f/. g77 is distributed as g77-someversion/f/
so that unpacking the g77 distribution is done in the normal GNU way,
resulting in a directory having the version number in the name. However,
to build g77, the g77 distribution must be merged with an appropriate gcc
distribution, normally in a gcc directory, before configuring, building,
and installing g77.
Applying g77 patches in the form of .diff files is done by typing
"patch -p1 -d gcc" (where gcc/f/ is the active version). That is,
g77 patches are distributed in the same form, and at the same directory
level, as patches to the gcc distribution.
gcc/f/ has text files that document the Fortran compiler, source
files for the GNU Fortran Front End (FFE), and some other stuff.
gcc/f/gbe/ has patch files for various versions of gcc, primarily
needed to patch the GNU compiler Back End (GBE) to fix and improve it
for use with g77. If a patch file exists for the version of gcc you
want to build along with g77, you MUST apply the patch before building
g77 with that version or g77 will not build or work properly.*
* Read gcc/f/gbe/README for more information.
gcc/f/runtime/ contains the run-time libraries for the f2c program, also used
by g77, and referred to as libf2c (though libf2c is really a combination of
two distinct libraries, libF77 and libI77 -- in g77, this distinction is
not made, and, further, Dave Love's implementation of libU77 is added
to the mix). This separate subdirectory is not part of the program g77, just
distributed with it. Some new files have been added to this subdirectory
and some minor changes made to the files contained therein, to fix some
bugs and facilitate automatic configuration, building, and installation of
libf2c for use by g77 users. See gcc/f/runtime/README for more information.
gcc/f/BUGS lists some important bugs known to be in g77. Or:
info -f gcc/f/g77.info -n "Actual Bugs"
gcc/f/ChangeLog lists recent changes to g77 internals.
gcc/f/INSTALL describes how to build and install GNU Fortran. Or:
info -f gcc/f/g77.info -n Installation
gcc/f/NEWS contains the per-release changes (not just user-visible ones
seen in gcc/f/DOC) listed in the ~fortran/.plan file. Or:
info -f gcc/f/g77.info -n News
* Read gcc/f/BUGS, gcc/f/INSTALL, and gcc/f/NEWS at the very least!
All users of g77 (not just installers) should read gcc/f/g77.info*
as well, using the "more" command if the "info" command is
unavailable or they aren't accustomed to using it.
If you want to get into the FFE code, which lives entirely in gcc/f/, here
are a few clues. The file g77.c is the stand-alone source file for the
`g77' command driver only -- this just invokes the `gcc' command, so it has
nothing to do with the rest of the code in g77. Most of the code
ends up in an executable named `f771', which does the actual compiling,
so it has the FFE merged with the gcc back end.
The file parse.c is the source file for main() for a stand-alone FFE and
yyparse() for f771. (Stand-alone building of the FFE doesn't work these days.)
The file top.c contains the top-level FFE function ffe_file and it (along
with top.h) define all ffe_[a-z].*, ffe[A-Z].*, and FFE_[A-Za-z].* symbols.
The file fini.c is a main() program that is used when building the FFE to
generate C header and source files for recognizing keywords. The files
malloc.c and malloc.h comprise a memory manager that defines all
malloc_[a-z].*, malloc[A-Z].*, and MALLOC_[A-Za-z].* symbols. All other
modules named <xyz> are comprised of all files named <xyz>*.<ext> and
define all ffe<xyz>_[a-z].*, ffe<xyz>[A-Z].*, and FFE<XYZ>_[A-Za-z].* symbols.
If you understand all this, congratulations -- it's easier for me to remember
how it works than to type in these grep patterns (such as they are). But it
does make it easy to find where a symbol is defined -- for example,
the symbol "ffexyz_set_something" would be defined in xyz.h and implemented
there (if it's a macro) or in xyz.c.
The "porting" files of note currently are: proj.h, which defines the
"language" used by all the other source files (the language being
Standard C plus some useful things like ARRAY_SIZE and such) -- change
this file when you find your system doesn't properly define a Standard C
macro or function, for example; target.h and target.c, which describe
the target machine in terms of what data types are supported, how they are
denoted (what C type does an INTEGER*8 map to, for example), how to convert
between them, and so on (though as of 0.5.3, more and more of this information
is being dynamically configured by ffecom_init_0); com.h and com.c, which
interface to the target back end (currently only FFE stand-alone and the GBE);
ste.c, which contains code for implementing recognized executable statements
in the target back end (again currently either FFE or GBE); src.h and src.c,
which describe information on the format(s) of source files (like whether
they are never to be processed as case-insensitive with regard to Fortran
keywords); and proj.c, which contains whatever code is needed to support
the language defined by proj.h.
If you want to debug the f771 executable, for example if it crashes,
note that the global variables "lineno" and "input_filename" are set
to reflect the current line being read by the lexer during the first-pass
analysis of a program unit and to reflect the current line being
processed during the second-pass compilation of a program unit. If
an invocation of the function ffestd_exec_end() is on the stack,
the compiler is in the second pass, otherwise it is in the first.
(This information might help you reduce a test case and/or work around
a bug in g77 until a fix is available.)
Any questions or comments on these topics, email egcs@cygnus.com