home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
644a.lha
/
gcc_v2p1-920420
/
README
< prev
next >
Wrap
Text File
|
1992-04-21
|
17KB
|
400 lines
First the legal stuff:
This archive contains two independant parts, one consists of the binaries
for the GNU C compiler V2.1, those files are all in the `gcc20' tree, and
are subject to the license specified in the COPYING file.
The other part consists of new versions for my shared C library and the
link level counterparts. Those files are subject to the COPYING.LIB file.
You can get the full distribution for gcc2.1 for example from
prep.ai.mit.edu, the source for the library is available for example from
amiga.physik.unizh.ch.
-----------------------------------------------------------------------------
A special note to the library: I'm currently changing the library sources
to finally adapt more closely to the BSD-net2 distribution. As a goal, this
library should then also support networking, starting with AF_UNIX sockets
and pipes implemented ala socketpair(). The library that is included in libs/
is a mixture between old and new code, I can therefore not distribute any
sources until the library has been changed completely. The reason I'm
including this version is that I'd like to get feedback whether the new
way to deal with packets that this library uses causes problems on some
Amigas. So if you find this library to cause problems (crashes, other weird
things), *AND THE PREVIOUS VERSION WORKED*, please tell me, I'd very much
like to get rid of such problems before the next version is released.
You might notice that the startup code changed, this is to allow full
implementation of execve() and friends, thus to actually pass an argument
vector instead of a commandline to started programs. vfork() is there
as well as wait4() and friends. You may try your luck on those new
functions, but keep in mind that *they are not supported* at the moment.
There are problems with vfork() that I'll fix in the next release, but I'll
have to include support for process groups to do it `right', currently you
cannot ^C break any children spawned with vfork() with the keyboard, BREAK
works though. An other problem exists with pipe(): if you break a reader,
the pipe might hang and you're not able to kill the writer. This will be
fixed by using sockets and sending the apropriate SIGPIPE to the writer
(the problem is permanent under 1.3, the 2.0 pipe is lots smarter, but not
yet perfect ;-)).
To repeat the important information: the functions are there, but unless
you know what you do, don't use them, not all problems are solved in this
library release!
-----------------------------------------------------------------------------
INSTALLATION
This distribution only contains the compilers and changed parts of my C
library. If you don't have a C library yet, you'll have to get one to be
able to compile C programs. You can either get my library (get
ixemlib9203.lha but use *THIS* ixemul.library in libs/ !!) or use another C
library you might already have. If you're not using my library, here's
what you have to do in short form:
o create a directory, assign GCC: to it
o create a directory called gcc:lib, here go your crt0.o and libc.a files
o create a directory called gcc:include, that's where your headers go
The ixemlib9203.lha archive contains a Readme that explains this setup
in greater detail).
The distribution contains 3 directories:
gcc20 - this contains stuff for gcc
gcc - this contains updates for the gcc: tree if you use my library
libs - this contains ixemul.library, which is used by gcc, and
which you have to copy to your LIBS: directory. This library
overrides all previous versions, please replace any older
copy!
To install gcc, you just have to assign GCC20: to gcc20/, ie. the directory
tree called gcc20/ that you created by unpacking this archive.
Then add gcc20:bin to your PATH, and you're finished installing gcc, it can
then be used like `gcc hello-world.c'.
*Be sure to use a large enough STACK setting! I'm using a STACK 250000 myself,
*and this worked even for the weirdest programs. You *will* crash the machine
*or get the weirdest errors if you use the Commodore default of 4k !!!!
The stuff in gcc/ should be copied to the apropriate place in your gcc:
tree, it gives you a newer startup code (that now passes DOSBase and
SysBase to your programs), and a newer libc.a (see the comments at the
begin as well for comments to this version of the library).
Repeating myself, copy libs/ixemul.library to LIBS: !
Read the original manuals as well: read the info* file in the info
directory. NOTE: the info files are not complete! I didn't include any
files that describe compiler interna, as they are not of interest to the
majority of users that don't plan to change gcc itself. If you want the
complete manual, get the whole distribution from (for example)
prep.ai.mit.edu! Second remark for 2.1: the provided info files are from
gcc2, since only interna changed, this is still a valid manual.
As a side effect of ixemul.library now converting paths like `/usr/include'
into `usr:include', you get requesters like `Please insert volume usr:'.
You can get rid of them by assigning a dummy directory to them. (You
could as well build a **IX tree, and place your stuff there). Candidats
for dummy-assigns are:
tmp: usr: etc: lib: local: dev:
As long as you don't want them to represent something useful, just make
sure the assigns exist, and you won't be nerved by those requesters.
HOW TO CALL THE C++ COMPILER
The Unix copy of gcc comes with a shell script, that emulates `gpp' in
its behavior to even call the C++ compiler on `*.c' files. Either call
your C++ files `*.cc' (the preferred solution), or call the C++ compiler
explicitly by using the `-x c++' switch to the compiler. The Unix `c++'
script includes `-lg++' by default, you have to do this explicitly when
calling gcc directly.
If you have AREXX installed in your system, you might as well use the
two AREXX commands provided by Loren J. Rittle (thanks Loren !), they
are in the rexx/ directory. Read them, they include instructions.
COEXISTANCE OF GCC 2.1 with GCC 1.40 & G++ 1.40
If you want to use the older compiler as well, all you have to do is to
rename gcc20:bin/gcc to gcc20:bin/gcc2, then you can use `gcc' and `gpp' as
usual to refer to the 1.40 compilers, and `gcc2' to refer to gcc2.1. You
might as well update some programs of 1.40:
copy gcc20:lib/gcc-lib/amiga/2.1/as local:gcc-as
copy gcc20:lib/gcc-lib/amiga/2.1/ld local:gcc-ld
Don't copy cpp over though, cpp depends on the compiler version !
If you're using g++-1.40 and the C++ compiler of gcc-2.1 concurrently, you'll
probably only want to keep one copy of C++ header files. G++ 1.40 expects to
find them under
LOCAL:g++-include
but gcc-2.0 looks for them in
GCC20:lib/g++-include
To fix this, you can either make a symbolic link to where you keep your
C++ headers, or you can use the following directory tree:
GCC20: -> <the base directory of your gcc20 tree>
LOCAL: -> GCC20:lib
/gcc-cpp }
/gcc-cc1 }
/gcc-cc1plus } these are the 1.40 compilers
/gcc-as }
/gcc-ld }
/g++-include C++ headers for both, 1.40 and 2.1
/gcc-lib/amiga/2.1
/specs 2.1 command template
/cpp }
/cc1 }
/cc1plus} these are the 2.1 compilers
/cc1obj }
/as }
/ld }
I'd recommend you switch to gcc 2, as I won't support the 1 release any
longer. With the new resident capability (see below) of gcc 2, less memory
is needed to fire up release 2 compilers.
DISK LAYOUT DIFFERENCES TO GCC 2.0
There are several differences. One you probably just noticed, the directory
structure changed again (sorry), mainly because gcc20: really stands for
the **IX /usr/local directory, and people wanted to have gcc specific stuff
not just in /usr/local/gcc, but in /usr/local/gcc-lib. Another difference:
The compilers are now in the target dependant directory (amiga/2.1), not
in the base directory (I might have done that wrong in 2.0 myself..).
So if you used 2.0, make sure to rename the gcc20:lib/gcc into
gcc20:lib/gcc-lib, and to delete the compilers in the gcc20:lib/gcc
directory.
AMIGA SPECIFIC CHANGES, NEW FOR 2.1
The most important change in 2.1 is that gcc finally can generate base
relative code (which means, that it addresses the data/bss segment by
indirection on A4). Based on base relative code, it is as well possible to
generate `pure' programs, ie. programs you can set the PURE bit on with
the PROTECT command, and then make them resident with the RESIDENT command.
Here's a short explanation for the new switches to gcc:
Option Explanation
-fbaserel generate base relative code (needed by cc1 and (!) ld)
-resident generate base relative code, and link it in a way so
that it is `pure' (see above). -resident does the same as
-fbaserel in cc1, but does additional work in ld.
-msmall-code generate 16bit BSRs instead of 32bit JSRs. This option
is only needed by as.
You may mix -msmall-code object files with normal object files. You
may as well mix base relative code with non base relative code, provided
that you specify -fbaserel to the linker. Don't (!) specify -resident
in this case, since code which was not compiled base relative is not
per se residentable with -resident!
*************************************************************************
All executables in this distribution are new compiled with -resident, and
are therefore RESIDENTable.
Please don't use REZ anymore on them, REZ doesn't recognise that they're
pure, and you'll lose the memory gains you get with RESIDENT.
*************************************************************************
With the addition of these features, new libraries were needed as well.
Besides the `old' libraries (libc.a, libgcc.a, crt0.o), you get new base
relative libraries (libbc.a, libbgcc.a, bcrt0.o), and a new startup
file (rcrt0.o) used to startup pure executables.
Here comes a technical implementation section (indented after `t').
Skip if you're not interested in those details.
t All the new support for base relative runtime support is in 2 new functions
t in ixemul.library. Here's a short explanation on what they do:
t
t void ix_resident (int num_par, int a4, int databss_size, long *relocs);
t
t This is the heart of the new functions. ix_resident() can be called
t in different ways, depending on the level of support you need/want.
t
t ix_resident (2, __a4_init);
t
t In this case, you get a plain base relative startup, the base
t register (a4) is set to the value provided by the linker (the __a4_init
t symbol).
t
t ix_resident (4, __a4_init, databss_size, relocs);
t
t In this case, you provide enough information to ix_resident, so that
t the data/bss segment can be relocated each time you call ix_resident().
t This way, each fresh copy of the process gets a unique databss segment,
t which makes the program pure. Please look at the bcrt0.c file to see
t how to implement resident programs based on ix_resident() support.
The second function provided is:
void ix_geta4 (void);
This function (re)loads the base register.
t Note: this functions works even for resident programs! Take care though,
t that you don't refer to the base register calling this function, as would
t happen if you just used the function as is (the glue functions use the
t `ixemulbase' to jump into the library, and this variable is addressed using
t a4 !). Use the direct calling method instead (see the README file for
t ixemul.library). A future version of gcc will include support for setting
t up the base register with a language extension (something like the SAS
t __saveds attribute), until then, you're at your own. Generally this
t doesn't matter though, as you only need to (re)load the base register by
t hand, if you start your own processes, and want them to use your globals as
t well.
SOME FREQUENTLY ASKED QUESTIONS
Q: `I keep getting requesters saying, that mathieeesingbas.library couldn't
be opened. Does gcc not work under 1.3??'
A: Gcc *does* work under 1.3, but it needs the single precision math libraries
to implement the C `float' data type. The mathieeesingbas.library is built
into ROM under Kick 2.04, but is needed as a file in LIBS: under Kick 1.3.
You have to ask your local Commodore support for this library, or if you're
lucky, you can get it from an (illegally.., not by myself!) posted article on
comp.sys.amiga.programmers. If you didn't capture that article, perhaps
somebody else had, but DON'T ASK ME! I won't send you neither the libraries
nor the article in question!
Q: `I don't get any .o files, even though the assembler seems to be called
correctly.'
A: This problem should have vanished in the mean time. It resulted from using
a bogous copy of the assembler. Use the one provided in this release, and
the problem should go away.
Q: `Program <xy> that uses ixemul.library requests the LOCAL: drive, which
I don't have?!'
A: ixemul.library searches LOCAL: for a timezone database. All you have to do
is assign LOCAL: to some existing directory, and the functions will be able
to determine that no such database exists. If you have gcc-1.40 installed,
you won't have this problem, as LOCAL: is used to find the compiler passes.
Q: `I keep getting a bus error using program <xy>, what's wrong?'
A: Tell me which program generated that error. This is most certainly a program
that contains 68020 code and which you tried to run on a 68000 machine.
As long as the program is not specifically marked as `68020 only', this is
to be considered a bug!
Note that `bus error' can mean both, a m68k bus error exception or a m68k
address error exception. The signal model uses only one signal for both.
This error might as well fit into the next question, read on!
Q: `My machine always crashes when I try to use gcc, or I get weird error
messages like "bus error" or "illegal instruction". Sometimes I can
successfully compile, but the machine crashes soon afterwards, when I
execute programs that normally don't crash.'
A: Did you set your STACK high enough? The Commodore default of 4k is WAYS too
low for GNU programs, I have my STACK at 250000, you might try lower
values, but I'd recommend not going below 100k !
Q: `I did "gcc -lg++ test.cc" and kept getting errors at link time'
A: Supply the libraries AFTER the source/object files.
Thus do `gcc test.cc -lg++' in this example. Don't forget to terminate
the command with a space, or AmigaDOS will swallow your last `+'.
Q: `Now that we have gcc release 2, can I remove my release 1 compilers?'
A: Depends on what you're programming in mostly. If you're only interested in
the C compiler, you can remove the 1.40 gcc, no problem. If you're a C++
programmer though, I'd suggest (if you have the disk space) you keep your
1.40 g++, since the language definition changed slightly from 1.40 to
2.0, and the 2.0 C++ compiler seems buggier than the 1.40 one. The 2.0
C-compiler could demonstrate reliability by recompiling itself, the C++
didn't have a comparable chance. Use the 2.0 C++ compiler though! The C++
language implemented by gcc2.0 is richer than the 1.40 one, templates are
supported, ANSI exceptions, etc. By keeping the 1.40 compiler you just keep
the option of reverting to 1.40 in cases where you're not sure whether your
program or the compiler is buggy.
2.1 note: please use 2.1 and report bugs to GNU! 2.1 should have all known
2.0 bugs fixed, and C++ should be quite stable by now.
Q: `Although I don't define "alloca" to be "__builtin_alloca", gcc2 uses its
builtin function for it, what can I do?'
A: Use the `-fno-builtin' switch.
EXAMPLE CONFIGURATION
Since getting gcc up and running seems to be harder than I thought (it does
have some crap in it that can only be expained historically..), I provide you
with my own setups, perhaps are examples more helpful than explanations...
s:user-startup
--------------
...
STACK 250000
ASSIGN gcc: dh4:mylibc
ASSIGN gcc20: dh4:gcc20-stuff
; dummies
ASSIGN tmp: t:
ASSIGN usr: dh6:usr
ASSIGN lib: gcc:lib
ASSIGN etc: local:
RESIDENT gcc20:lib/gcc-lib/amiga/2.1/cpp
RESIDENT gcc20:lib/gcc-lib/amiga/2.1/cc1
;I don't have those resident, because I use them too seldom
;RESIDENT gcc20:lib/gcc-lib/amiga/2.1/cc1plus
;RESIDENT gcc20:lib/gcc-lib/amiga/2.1/cc1obj
RESIDENT gcc20:lib/gcc-lib/amiga/2.1/as
RESIDENT gcc20:lib/gcc-lib/amiga/2.1/ld
RESIDENT c:gcc2
dh4:mylibc/
----------
contains (among other stuff):
dh4:mylibc/include my header files
dh4:mylibc/lib the libraries and startup files
dh4:gcc20-stuff/
---------------
contains (among other stuff):
dh4:gcc20-stuff/bin:
gcc
dh4:gcc20-stuff/info:
gcc-manual.lha
dh4:gcc20-stuff/lib:
g++-include gcc-lib
dh4:gcc20-stuff/lib/gcc-lib:
amiga
dh4:gcc20-stuff/lib/gcc-lib/amiga:
2.1
dh4:gcc20-stuff/lib/gcc-lib/amiga/2.1:
SYSCALLS.c.X as cc1 cc1obj cc1plus
cpp ld libbgcc.a libg++.a libgcc.a specs
FINALLY...
Good luck with this really great compiler. I'd like to thank all the wonderful
guys that made this compiler what it is today, thank you! For the contributors
to gcc, read the GNU CC manual!
-Markus Wild
You can reach me as:
<wild@nessie.cs.id.ethz.ch> or as <wild@amiga.physik.unizh.ch>