As , The Gnu Assembler; Object Files - Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Manual

Developer tools guide
Hide thumbs Also See for ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE:
Table of Contents

Advertisement

6
2.5.
, the GNU Preprocessor
cpp
is a C-compatible macro preprocessor that works with the GNU compiler to direct the parsing of
cpp
C preprocessor directives. Preprocessing directives are the lines in your program that start with a
directive name (a
sign followed by an identifier). For instance,
#
macro definitions, and processes
defines a macro (
#define
To refer to the output of
stdout
The C preprocessor provides the following separate facilities:
Inclusion of header files — Declarations that can be substituted into your program.
Macro expansion When defining macros, which are abbreviations for arbitrary fragments of C code,
the C preprocessor replaces them with their definitions throughout a program.
Conditional compilation — Using special preprocessing directives, include or exclude parts of a
program according to replaceableious conditions.
Line control — Using a program to combine or rearrange source files into an intermediate file that
is then compiled, use line control to provide a source line's origin.
There are two convenient options to assemble files that require C-style preprocessing. Both options
depend on using the compiler driver program,
Name the source file using the extension
sembly language program that requires C-style preprocessing).
Specify a source language explicitly for a situation, using the
For more information on
2.6.
, the GNU Assembler
as
, the GNU assembler, translates text-based assembly language source files into binary-based object
as
files. Normally it operates without you being aware of it, as the compiler driver program (
it automatically. However, if you are creating your own assembler source files, you must invoke
directly.
If, while using
, you want to pass special command-line options to the assembler to control its be-
gcc
havior, you need to use the
to the assembler's command line. For example:
gcc -c -g -O -Wa,-alh,-L file.c
passes the
command line option on to the assembler. (This causes the assembler to emit a listing
-alh
file that shows the assembler source generated by the compiler for each line of the C source file
.
file.c)
For more information, refer to Using as, the Gnu Assembler.

2.6.1. Object Files

The assembler creates object files that, by convention, have the
that contain the assembled source code, information to help the linker integrate the object file into an
executable program, debugging information and tables of all of the symbols used in the source code.
sections. Another example is
#ifdef
must be followed by a macro name and the macro's intended expansion).
, invoke
with the
cpp
gcc
.S
, refer to Using cpp, the C Preprocessor.
cpp
command-line option. This option passes
'-Wa,<text>'
Chapter 2. Basic Principles of the Tools
cpp
option; the preprocessed file will print on
-E
, instead of directly calling the assembler.
gcc
(capitalized), rather than
-xassembler-with-cpp
.o
merges
files, expands
#include
, a directive that
#define
(the
indicates an as-
.s
.S
gcc
<text>
extension. These are binary files
#
option.
) invokes
as
directly

Advertisement

Table of Contents
loading

Table of Contents