Writing ARM and Thumb Assembly Language
ARM DUI 0068B
Copyright © 2000, 2001 ARM Limited. All rights reserved.
2-13
Labels
Labels are symbols that represent addresses. The address given by a label is calculated
during assembly.
The assembler calculates the address of a label relative to the origin of the section where
the label is defined. A reference to a label within the same section can use the program
counter plus or minus an offset. This is called
program-relative addressing
.
Labels can be defined in a map. See
Describing data structures with MAP and FIELD
directives
on page 2-51. You can place the origin of the map in a specified register at
runtime, and references to the label use the specified register plus an offset. This is
called
register-relative addressing
.
Addresses of labels in other sections are calculated at link time, when the linker has
allocated specific locations in memory for each section.
Local labels
Local labels are a subclass of label. A local label begins with a number in the range
0-99. Unlike other labels, a local label can be defined many times. Local labels are
useful when you are generating labels with a macro. When the assembler finds a
reference to a local label, it links it to a nearby instance of the local label.
The scope of local labels is limited by the
AREA
directive. You can use the
ROUT
directive
to limit the scope more tightly.
Refer to the
Local labels
on page 3-16 for details of:
•
the syntax of local label declarations
•
how the assembler associates references to local labels with their labels.
Comments
The first semicolon on a line marks the beginning of a comment, except where the
semicolon appears inside a string constant. The end of the line is the end of the
comment. A comment alone is a valid line. All comments are ignored by the assembler.