Major cutover to using system.h:
[gcc.git] / gcc / README.g77
1 1997-06-20
2
3 This directory contains the version 0.5.21 release of the GNU Fortran
4 compiler. The GNU Fortran compiler is free software. See the file
5 COPYING.g77 for copying permission.
6
7 * IMPORTANT: Things you _must_ do are marked with a * at the beginning of
8 the line in this file!!!
9
10 This README is for GNU Fortran, and describes the files in the f/
11 directory. The f/ directory is intended to be a subdirectory of a
12 gcc source tree. These directories are referred to below as gcc/,
13 which is the top-level directory containing the gcc back end, the
14 gcc C front end, and other non-Fortran files, and gcc/f/, which
15 contains all of the Fortran files.
16
17 * Note, if this is an egcs release, all the installation information
18 which follows is not needed. It is provided for historical reference
19 only.
20
21 * To build GNU Fortran, you must have a source distribution of gcc
22 version 2.7.2.2. Do not attempt to use any other version
23 of gcc, because this version of g77 is designed to work only with
24 gcc version 2.7.2.2.
25
26 * Note that you must have source copies of these gcc distributions!!
27 You cannot build g77 just using binaries of gcc. Also, unless you
28 are an expert, avoid using any distribution of gcc not identical to
29 the one distributed by the FSF -- for example, using a special version
30 modified to produce better code for the Pentium (sometimes labeled
31 gcc-i2.6.3 -- note the `i') will not work with this distribution of g77.
32
33 If you have just unpacked the g77 distribution, before proceeding,
34 you must merge the contents of the g77 distribution with the appropriate
35 gcc distribution on your system before proceeding.
36
37 * Read and follow the instructions in g77-0.5.21/f/INSTALL that
38 explain how to merge a g77 source directory into a gcc source
39 directory. You can use Info to read the same installation
40 instructions via:
41
42 info -f g77-0.5.21/f/g77.info -n Unpacking
43
44 The resulting directory layout includes the following, where gcc/ might be
45 a link to, for example, gcc-2.7.2.2/:
46
47 gcc/ Non-Fortran files in gcc (not part of g77*.tar)
48 gcc/README.g77 This file
49 gcc/f/ GNU Fortran front end
50 gcc/f/gbe/ Patches required for gcc back end versions
51 gcc/f/runtime/ libf2c configuration and f2c.h file generation
52 gcc/f/runtime/libF77/ Non-I/O portion of libf2c
53 gcc/f/runtime/libI77/ I/O portion of libf2c
54 gcc/f/runtime/libU77/ Additional interfaces to libc for libf2c
55
56 gcc/f/ as a whole contains the program GNU Fortran (g77), plus a portion
57 of the separate program f2c, which is in gcc/f/runtime. NOTE: The f2c
58 code is not part of the program g77, just distributed with it.
59
60 This directory is named gcc/f/ because it, along with its contents, is
61 designed to be a subdirectory of a GNU CC (gcc) development directory. I.e.
62 when a gcc distribution is unpacked into a directory (named gcc/ for
63 example), it typically contains subdirectories like gcc/config/ and
64 gcc/cp/. The latter is the subdirectory for the GNU C++ (g++) program.
65
66 Similarly, the g77 directory f/ is designed to be placed in gcc/ so that
67 it becomes the subdirectory gcc/f/. g77 is distributed as g77-someversion/f/
68 so that unpacking the g77 distribution is done in the normal GNU way,
69 resulting in a directory having the version number in the name. However,
70 to build g77, the g77 distribution must be merged with an appropriate gcc
71 distribution, normally in a gcc directory, before configuring, building,
72 and installing g77.
73
74 Applying g77 patches in the form of .diff files is done by typing
75 "patch -p1 -d gcc" (where gcc/f/ is the active version). That is,
76 g77 patches are distributed in the same form, and at the same directory
77 level, as patches to the gcc distribution.
78
79 gcc/f/ has text files that document the Fortran compiler, source
80 files for the GNU Fortran Front End (FFE), and some other stuff.
81
82 gcc/f/gbe/ has patch files for various versions of gcc, primarily
83 needed to patch the GNU compiler Back End (GBE) to fix and improve it
84 for use with g77. If a patch file exists for the version of gcc you
85 want to build along with g77, you MUST apply the patch before building
86 g77 with that version or g77 will not build or work properly.*
87
88 * Read gcc/f/gbe/README for more information.
89
90 gcc/f/runtime/ contains the run-time libraries for the f2c program, also used
91 by g77, and referred to as libf2c (though libf2c is really a combination of
92 two distinct libraries, libF77 and libI77 -- in g77, this distinction is
93 not made, and, further, Dave Love's implementation of libU77 is added
94 to the mix). This separate subdirectory is not part of the program g77, just
95 distributed with it. Some new files have been added to this subdirectory
96 and some minor changes made to the files contained therein, to fix some
97 bugs and facilitate automatic configuration, building, and installation of
98 libf2c for use by g77 users. See gcc/f/runtime/README for more information.
99
100 gcc/f/BUGS lists some important bugs known to be in g77. Or:
101
102 info -f gcc/f/g77.info -n "Actual Bugs"
103
104 gcc/f/ChangeLog lists recent changes to g77 internals.
105
106 gcc/f/INSTALL describes how to build and install GNU Fortran. Or:
107
108 info -f gcc/f/g77.info -n Installation
109
110 gcc/f/NEWS contains the per-release changes (not just user-visible ones
111 seen in gcc/f/DOC) listed in the ~fortran/.plan file. Or:
112
113 info -f gcc/f/g77.info -n News
114
115 * Read gcc/f/BUGS, gcc/f/INSTALL, and gcc/f/NEWS at the very least!
116 All users of g77 (not just installers) should read gcc/f/g77.info*
117 as well, using the "more" command if the "info" command is
118 unavailable or they aren't accustomed to using it.
119
120 If you want to get into the FFE code, which lives entirely in gcc/f/, here
121 are a few clues. The file g77.c is the stand-alone source file for the
122 `g77' command driver only -- this just invokes the `gcc' command, so it has
123 nothing to do with the rest of the code in g77. Most of the code
124 ends up in an executable named `f771', which does the actual compiling,
125 so it has the FFE merged with the gcc back end.
126
127 The file parse.c is the source file for main() for a stand-alone FFE and
128 yyparse() for f771. (Stand-alone building of the FFE doesn't work these days.)
129 The file top.c contains the top-level FFE function ffe_file and it (along
130 with top.h) define all ffe_[a-z].*, ffe[A-Z].*, and FFE_[A-Za-z].* symbols.
131 The file fini.c is a main() program that is used when building the FFE to
132 generate C header and source files for recognizing keywords. The files
133 malloc.c and malloc.h comprise a memory manager that defines all
134 malloc_[a-z].*, malloc[A-Z].*, and MALLOC_[A-Za-z].* symbols. All other
135 modules named <xyz> are comprised of all files named <xyz>*.<ext> and
136 define all ffe<xyz>_[a-z].*, ffe<xyz>[A-Z].*, and FFE<XYZ>_[A-Za-z].* symbols.
137 If you understand all this, congratulations -- it's easier for me to remember
138 how it works than to type in these grep patterns (such as they are). But it
139 does make it easy to find where a symbol is defined -- for example,
140 the symbol "ffexyz_set_something" would be defined in xyz.h and implemented
141 there (if it's a macro) or in xyz.c.
142
143 The "porting" files of note currently are: proj.h, which defines the
144 "language" used by all the other source files (the language being
145 Standard C plus some useful things like ARRAY_SIZE and such) -- change
146 this file when you find your system doesn't properly define a Standard C
147 macro or function, for example; target.h and target.c, which describe
148 the target machine in terms of what data types are supported, how they are
149 denoted (what C type does an INTEGER*8 map to, for example), how to convert
150 between them, and so on (though as of 0.5.3, more and more of this information
151 is being dynamically configured by ffecom_init_0); com.h and com.c, which
152 interface to the target back end (currently only FFE stand-alone and the GBE);
153 ste.c, which contains code for implementing recognized executable statements
154 in the target back end (again currently either FFE or GBE); src.h and src.c,
155 which describe information on the format(s) of source files (like whether
156 they are never to be processed as case-insensitive with regard to Fortran
157 keywords); and proj.c, which contains whatever code is needed to support
158 the language defined by proj.h.
159
160 If you want to debug the f771 executable, for example if it crashes,
161 note that the global variables "lineno" and "input_filename" are set
162 to reflect the current line being read by the lexer during the first-pass
163 analysis of a program unit and to reflect the current line being
164 processed during the second-pass compilation of a program unit. If
165 an invocation of the function ffestd_exec_end() is on the stack,
166 the compiler is in the second pass, otherwise it is in the first.
167 (This information might help you reduce a test case and/or work around
168 a bug in g77 until a fix is available.)
169
170 Any questions or comments on these topics, email egcs@cygnus.com