|
Tachyon z/Assembler for GCC
Now you can build OS/390 programs for FREE
using GCC and the Tachyon z/Assembler!
- GCC: the GNU Compiler Collection
- GCC is a collection of free, open-source compilers.
The languages supported by these compilers include: C, C++, FORTRAN, ADA, JAVA and others.
GCC is usually used to build programs for UNIX and UNIX-like operating systems such as LINUX.
When IBM created the S/390 port of LINUX, they necessarily added S/390 support in GCC.
Usually programmers use GCC to generate object files or executable programs without
knowing how it works.
What is normally unseen is that GCC generates GNU assembler code and then invokes
the GNU assembler and the linker.
It is actually the assembler which produces the object files and the linker which
produces executable programs.
GCC can be told to avoid invoking the assembler and linker and instead to retain the
GNU assembler source file.
This is where the Tachyon z/Assembler can be used to generate object code
for OS/390 or z/OS instead of Linux for S/390 and zSeries.
GCC is distributed in both source and executable form.
The same source can be used to build versions for many different platforms
and architectures.
GCC can even be built as a cross compiler, running on one platform but
generating code for another platform.
If you want to generate code for an S/390 platform, you can either
run the GCC provided with Linux for S/390 and zSeries or you can build
a cross compiler to run on Linux/x86, Windows or any other supported platform.
GCC produces excellent, well-optimized machine instructions.
Hartmut Penner, who maintains the S/390 and zSeries versions of GCC, works for
IBM Germany and understands how to generate instructions which cause a minimum
of pipeline stalls on S/390 and zSeries machines.
More information about GCC and the generated GNU assembler code was presented at
at SHARE 98 session 8131.
The session handout is available in PDF format.
Further information about assembler programming for Linux for S/390 and
zSeries will be presented at SHARE 99 session 8139.
- Using GCC to build S/390 Programs
- At this time, there are two ways to use GCC to build OS/390 and z/OS programs.
Dave Pitts I370 port of GCC
can run on OS/390, generates unoptimized HLASM-style assembler code and uses the
IBM Language Environment as a runtime library.
The second way is to use the Tachyon z/Assembler to generate GOFF object
code from the GNU assembler code generated by the Linux for S/390 and zSeries
version of GCC.
To build OS/390 and z/OS programs using GCC and the Tachyon z/Assembler, you need:
- GCC
- Using version 3.0.2 or later of GCC is recommended.
The 2.9 versions of GCC which were distributed with early versions
of Linux for S/390 do not generate nearly as optimized code as the 3.0 and later versions.
You can download current and old versions of GCC by following links from
the GCC home page.
- Tachyon z/Assembler
- Version 2.2 of the Tachyon z/Assembler an later includes
the tas program, which is available free-of-charge.
The tas program can be used to invoke the Tachyon z/Assembler
to create ELF and GOFF object files from GCC-generated GNU assembler source.
You can download the Tachyon z/Assembler for GCC
and use the tas program on any of the following platforms:
Linux for S/390 and zSeries, Linux/x86, Windows, AIX or Solaris.
You will need version 2.2.15 or later of the Tachyon z/Assembler to assemble
the output of GCC version 3.3.
- LIB390
- On LINUX, the GCC runtime library is provided by GLIBC.
Since GLIBC does not include an OS/390 interface, another library is needed.
Tachyon Software has provided the start of an
open-source OS/390 runtime library for GCC called LIB390.
Tachyon Software will continue to enhance LIB390 and encourages contributions
from others interested in extending the library.
To compile a C program for OS/390 or z/OS using GCC do the following:
- Run the gcc
program using the -S option to cause it to create a GNU assembler source file.
For instance, to compile the program hello.c and create the GNU assembler
source file hello.s, you can use the following command:
gcc -S -O3 hello.c
- Run the tas program to assemble the GNU assembler file
and create a GOFF object file.
For instance, to assemble hello.s and create an object file named
hello.obj and a listing file named hello.lst,
you can use the following command:
tas -o hello.obj -goff -a hello.s
- Upload the object files to OS/390 or z/OS and link them with the LIB390
object files.
Alternatively, you can use the Tachyon File Tools
to link the object files and create a TSO XMIT file which can then be
uploaded to OS/390 and z/OS.
More information about using the tas program can be found in
Appendix F of the Tachyon
390 Cross Assembler and Tachyon z/Assembler Users Guide.
|
|