Invoke the Linkage Editor

The linkage editor link-edits all of the specified object files to create one executable file. Invoking the compiler with one of the invocation commands automatically calls the linkage editor unless you specify one of the following compiler options: -E, -P, -c, -S, -qsyntaxonly or -#.

Input Files
Object files, library files, and unstripped executable files serve as input to the linkage editor.

Object Files
Object files must have a .o suffix, for example, year.o.

Library Files
Static library file names have a .a suffix, for example, libold.a. Dynamic library file names have a .so suffix, for example, libold.so. Library files are created by combining one or more files into a single archive file with the AIX ar command. For a description of the ar command, refer to the AIX Version 4 Commands Reference.

Output Files
The linkage editor generates an executable file and places it in your current directory. The default name for an executable file is a.out. To name the executable file explicitly, use the -ofile_name option with the xlC command, where file_name is the name you want to give to the executable file. If you use the -qmkshrobj option to create a shared library, the default name of the shared object created is shr.o.

Using the ld Command
You can invoke the linkage editor explicitly with the ld command. However, the compiler invocation commands set several linkage-editor options, and link some standard files into the executable output by default. In most cases, it is better to use one of the compiler invocation commands to link-edit your .o files.

Note: When link-editing .o files, do not use the -e option of the ld command. The default entry point of the executable output is __start. Changing this label with the -e flag can cause erratic results.



Invoke the Batch Compiler


Options that Specify Linkage Options