Assembling GCC Programs

The tas command line interface program can be used to assemble the GNU assembler source code generated by the GCC compilers of Linux for S/390 and zSeries. From this GNU assembler source, the tas program can generate an object code file that can be linked and run on 31-bit Linux for S/390 and zSeries, 64-bit Linux for zSeries and 31-bit OS/390 and z/OS.

Normally, the GCC compilers will delete the GNU assembler source after invoking the GNU assembler. To instruct GCC to not delete the assembler source file and to not invoke the GNU assembler, use the gcc -S option. For instance to generate the GNU assembler source file from the hello.c program, compile it using: gcc -S hello.c. If the compile is successful, a file named hello.s will be created. The GCC compiler’s optimizer generates very fast assembler code, so you may also want to invoke gcc with the -O2 or -O3 option. To generate 64-bit GNU assembler code for Linux for zSeries, you will also need to use the gcc -m64 option.

Once the GNU assembler source file has been generated by GCC, it can be assembled using the tas program. You can assemble it one of three ways:

  1. 31-bit code can be assembled to run on Linux for S/390 and zSeries.
  2. 64-bit code can be assembled to run on Linux for zSeries.
  3. 31-bit code can be assembled to run on OS/390 or z/OS.

Assembling for 31-bit Linux

To assemble a GCC-generated GNU assembler source file for 31-bit Linux for S/390 and zSeries, run the tas program without any of the following options: -m64, -massist and -goff. If the -o option is also specified, the Tachyon z/Assembler will produce a 31-bit ELF object file. This object file can be linked with the 31-bit S/390 version of the ld linker program for Linux. For example:

gcc -S -O2 hello.c
tas -v -a -o hello.o hello.s

Assembling for 64-bit Linux

To assemble a GCC-generated GNU assembler source file for 64-bit Linux for S/390 and zSeries, run the tas program with the -m64 option. If the -o option is also specified, the Tachyon z/Assembler will produce a 64-bit ELF object file. This object file can be linked with the 64-bit S/390 version of the ld linker program for Linux. For example:

gcc -S -O2 -m64 hello.c
tas -v -a -m64 -o hello.o hello.s

Assembling for OS/390 and z/OS

To assemble a GCC-generated GNU assembler source file for 31-bit OS/390 or z/OS, run the tas program with the -goff option. If the -o option is also specified, the Tachyon z/Assembler will produce a GOFF object file. This object file can be linked with the OS/390 or z/OS binder or with the Tachyon Linkage Editor. For example:

gcc -S -O2 hello.c
tas -v -a -goff -o hello.o hello.s

Compatibility

The Tachyon z/Assembler’s GNU assembler to HLASM translator can convert a large subset of the GNU assembler language, including code generated by GCC from C language programs. Due to current limitations on section names in the ELF support of the Tachyon z/Assembler, the code generated by GCC from C++ programs cannot be assembled. The GNU assembler to HLASM translator cannot convert code generated by the gcc -fpic or -fPIC options.

Unlike normal input files read by the Tachyon z/Assembler, GNU assembler source files must consist of delimited ASCII lines.


Frames No Frames Previous Next Contents
Introduction Setup Running Options Macros Translation Compatibility Messages
© Copyright 2002-2004, Tachyon Software® LLC.
Last modified on January 31, 2004