The IRIS-4D compiler system consists of a set of components that enable you to create executable modules from programs written in languages such as C, C++, Fortran 77, and Pascal.
The compiler system:
uses Executable and Linking Format (ELF) for object files. ELF is the format specified by System V Release 4 Applications Binary Interface (SVR4 ABI). Refer to "Executable and Linking Format" for additional information.
uses shared libraries, called Dynamic Shared Objects (DSOs). DSOs are loaded at run time instead of at linking time, by the run-time linker, rld. The code for DSOs is not included in executable files; thus, executables built with DSOs are smaller than those built with non-shared libraries, and multiple programs can use the same DSO at the same time. For more information, see Chapter 3, "Dynamic Shared Objects."
creates Position-Independent Code, (PIC) by default, to support dynamic linking. See "Position-Independent Code,"for additional information.
Table 1-1 summarizes the IRIS-4D compiler system components and the task each performs.
Table 1-1. Compiler System Functional Components
Tool | Task | Examples |
---|---|---|
Text editor | Write and edit programs | vi, jot, emacs |
Compiler driver | Compile and link programs | cc, f77, pc, as |
Object file analyzer | Analyze object files | elfdump, file, nm, odump, size, strip |
Profiler | Analyze program performance | prof, pixie |
Procedure rearranger | Minimize paging/maximize instruction cache hit rate | cord |
Optimizer | Improve program performance | uopt |
Archiver | Produce object-file libraries | ar |
Run-time linker | Link Dynamic Shared Objects at run time | rld |
Debugger | Debug programs | dbx |
A single program called a compiler driver (such as cc, f77, or pc) invokes the following major components of the compiler system (refer to Figure 1-1).
![]() | Note: C++ has a specialized driver, CC, with slightly different options from cc, f77, and pc. Refer to the C++ Programming Guide and C++ reference page for details. |
You can invoke a compiler driver with various options (described later in this chapter) and with one or more source files as arguments. All specified source files are automatically sent to the macro preprocessor.
![]() | Note: Preprocessing is done by cfe. The old preprocessors (cpp for "traditional" Kernighan & Ritchie C, or acpp for ANSI C) are still available for non-compilation preprocessing and preprocessing for copt, ccom_mp, and accom_mp, in case you want to use them. |
Although the macro preprocessor was originally designed for C programs, it is now run by default as part of most compilations. To prevent the preprocessor from being run, specify the –nocpp option on the driver command line.
If available, the parallel analyzers pca and pfa produce parallelized source code from standard source code. The result takes advantage of multiple CPUs (when present) to achieve higher computation rates. pca and pfa are part of the Power C and Power Fortran packages; for information about these packages and how to obtain them, contact your dealer or sales representative.
The compilers proper, often called "front ends," translate source code into intermediate code. The available compiler front ends are cfe (C), ccom_mp and accom_mp (parallel C), fcom (Fortran 77), and upas (Pascal). ujoin, uld, umerge, and uopt comprise the optimization subsystem of the compiler system. (For more information about profiling, see Chapter 4, "Using the Performance Tools." For information about optimization, see Chapter 5, "Optimizing Program Performance.") ugen and as1 make up the code-generation subsystem of the compiler system.
The linker ld combines several object files into one, performs relocation, resolves external symbols, and merges symbol table information for symbolic debugging. The driver automatically runs ld unless you specify the –c option to skip the linking step.
To see the various utilities a program passes through during compilation, invoke the appropriate driver with the –v option (or +v for the C++ driver CC).
When you compile or link programs, by default, the compiler searches
/usr/lib, /lib, and /usr/local/lib. Certain default libraries are automatically linked. Drivers and their respective libraries are listed in Table 1-2.
Table 1-2. Compilers and Default Libraries
Compiler | Default LIbraries |
---|---|
cc | libc.so |
CC | libC.so, libc.so |
f77 | libftn.so, libc.so, libm.so |
Figure 1-1 shows compilation flow from source file to executable file (a.out).