About
-----
This archive contains a uptodate version of a AmigaOS (68k)
hosted gcc cross compiler environment for compiling/porting
existing applications to Amithlon (x86).
By installing this cross compiler, one will be able to
easily port existing AmigaOS application to the new x86 hosted
Amithlon emulation (www.amithlon.net)
This version is based on the 2.95.3 version of the gcc compiler
with changed mainly made by Martin Blom <martinblom.org>.
http://www.lysator.liu.se/~lcs/files/gg-cross
Please note that you also need the x86-ami-bin.lha archive to
successfully use the cross-compiler.
Jens Langner <Jens.Langnerlight-speed.de>
July 2002
Documentation
-------------
Setting up a i686be-amithlon cross compiler under AmigaOS
---------------------------------------------------------
1) If you don't have a GeekGadget environment:
Make a GeekGadget directory somewhere, and assign GG: to it.
1> makedir some_volume:GeekGadgets
1> assign GG: some_volume:GeekGadgets
Make a GG:bin directory, and add it to your path, or add it to
your c: assign.
1> makedir GG:bin
1> path GG:bin add
2) Unarchive the "x86-ami-bin.lha" and "x86-ami-gcc.lha" in GG:
1> cd GG:
1> lha x some_dir/x86-ami-bin.lha
1> lha x some_dir/x86-ami-gcc.lha
Warning 1:
----------
If you are unarchiving on a filesystem that doesn't support
hard-links (e.g. SFS), you will have error messages and will
need to make the links by hand (or replace them with copies).
You need to have:
gg:i686be-amithlon/bin/as -> gg:bin/i686be-amithlon-as
gg:i686be-amithlon/bin/ar -> gg:bin/i686be-amithlon-ar
gg:i686be-amithlon/bin/ld -> gg:bin/i686be-amithlon-ld
gg:i686be-amithlon/bin/nm -> gg:bin/i686be-amithlon-nm
gg:i686be-amithlon/bin/ranlib -> gg:bin/i686be-amithlon-ranlib
gg:i686be-amithlon/bin/strip -> gg:bin/i686be-amithlon-strip
where "->" means "link to" or "copy of".
Warning 2:
----------
If using soft links, you have to specify the full path of the
destination, not just a relative one.
Warning 3:
----------
If using soft links under SFS, you need at least SFS version 1.62.
3) Copy the contents of the amithlon gcc includes to
GG:i686be-amithlon/sys-include
1> copy somepath/includeamithlon GG:i686be-amithlon/sys-include all
4) Copy the lib directory from the amithlon lib archive to
GG:i686be-amithlon/lib and GG:i686be-amithlon/lib/libnix
1> copy somepath/lib/libamigastubs.a GG:i686be-amithlon/lib
1> copy somepath/lib/libnix GG:i686be-amithlon/lib ALL
you can get those files from
http://www.lysator.liu.se/~lcs/files/gg-cross
Usage
-----
Currently, as there is no ixemul part for this amithlon gcc compiler,
you always have to specify -noixemul for compiling something.
To compile 'hello.c' to 'hello' using libnix:
1> i686be-amithlon-gcc -noixemul -o hello hello.c
To strip debugging informations and symbols from an executable file:
1> i686be-amithlon-strip hello
To compile and link separately:
1> i686be-amithlon-gcc -noixemul -c hello1.c
1> i686be-amithlon-gcc -noixemul -c hello2.c
1> i686be-amithlon-gcc -noixemul -r -o hello hello1.o hello2.o
(the last step can be replaced by a direct call to i686be-amithlon-ld)
Please note that your have to use the "-r" option for the moment like
in former PowerUP days, as the linker isn`t fully working yet without
it.
* Some useful options:
-O, -O2, -O3 to optimize (-O3 make files bigger, be careful)
-mcpu=i386, -mcpu=i486, -mcpu=pentium, -mcpu=k6 to optimize for a
specific cpu. Files optimized for one processor still work on others.
-v to view the exact commands executed by gcc, and its include
search path. Useful to find out installation problems.
* Predefined symbols:
__ELF__, __pentiumpro__, __amithlon__
__i386__ if compiled with -mcpu=i386
__i486__ if compiled with -mcpu=i486
__i586__ if compiled with -mcpu=i586 or -mcpu=k6
__i686__ if compiled without -mcpu= or -mcpu=pentiumpro
__amigaos__, amigaos, amiga, AMIGA, MCH_AMIGA for compatibility
* Some remarks:
1) This compiler uses the natural alignment, i.e. in
struct S
{
short a;
long b;
};
the offset of 'b' is 4, and not 2 as with 68k compilers. You can
force the alignment to be 2 by defining S as follow:
struct S
{
short a;
long b __attribute__((aligned(2)));
} __attribute__((packed));
or even better by:
#pragma pack(2)
struct S
{
short a;
long b;
};
#pragma pack()
Usually you shouldn't care about that, except in interfaces with
external libraries, or for binary compatibility if you read/write
such structures from/to files.
Attn: floats and doubles must _never_ have an alignment lower than 4.
2) The diff file on which this release was build can be found at:
http://www.lysator.liu.se/~lcs/files/gg-cross
Have phun
and keep up the good work
Jens Langner <Jens.Langnerlight-speed.de>
July 2002
|