Batch assemblies for Linux on z Systems

HLASM for Linux® on z Systems® supports batch assemblies in the same manner as on other platforms for both OBJ and GOFF output. However, when using the ELF conversion exit ASMAXT2E, special care should be taken to avoid the ELF objects being placed into the same output file. The reason for this is that other Linux tooling such as ld and objdump only handle the first ELF object in a file.

To support batch assemblies for Linux on z Systems, HLASM supports the creation of object archives which use the -U and -R command line options and are used to specify:

-U directory_name
The directory specified by directory_name will be used to store the resultant ELF objects produced by the ASMAXT2E exit in a batch assembly. The produced object file names have a naming convention of nnnn_sectionName.o where nnnn is the number of the program being assembled in the batch. sectionName is the name of the first section in the program being assembled in the batch.
-R archive_command
An archive command starting with archive_command will be built by HLASM to include all object file names, and then run at the end of HLASM’s processing. This can be used to create object archives that can then be passed directly to the Linux linker.

The -U and -R options should not be used together with the -o option.

Using the two options together, it is possible to create an object archive which contains all the objects produced from a batch assembly, for example:

asma90 my_prog \
        -l my_listing \
        -U my_output_directory \
        -R "ar -cvq my_arc.a" \
        -E /path_to_ASMAXT2E \
        -L /path_to_asmalib \
        --options="ELF32,BATCH,SIZE(256M)"

where:

my_prog
The name of the program being assembled.
-l my_listing
The name of the file to contain the HLASM listing for the program.
-U my_output_directory
The name of the directory into which the produced object files will be placed
-R "ar -cvq my_arc.a"
The archive command which have appended to it names of all the produced object files from the batch assembly and then run in order to create an object archive.
-E /path_to_ASMAXT2E
The path to the ASMAXT2E object exit.
-L /path_to_asmalib
specifies the path of asmalib and the SYSLIB path names.
--options
The options passed to HLASM.

Assuming that the contents of my_prog contained two programs which started with the control section names A_SECT and B_SECT, HLASM will produce the following files:

my_listing
The listing for all assemblies processed
0001_A_SECT.o
The ELF object file for the assembly of the first program in the batch whose first section name was called A_SECT.
0002_B_SECT.o
The ELF object file for the assembly of the second program in the batch whose first section name was called B_SECT.
my_arc.a
An object archive file produced as if the command ar -cvq my_arc.a 0001_A_SECT.o 0002_B_SECT.o had been run. This produced archive can be passed directly to the Linux linker for processing.