5.8.19. DATA directive

The DATA directive informs the assembler that a label is a data-in-code label. This means that the label is the address of data within a code segment.

Syntax

The syntax of DATA is:

label DATA

where:

label

is the label of the data definition. The DATA directivemust be on the same line as label.

Usage

You must use the DATA directive when you define data in a Thumb code area with any of the data-defining directives such as DCD, DCB, and DCW.

When the linker relocates a label in a Thumb code area, it assumes that the label represents the address of a Thumb routine. The linker adds 1 to the value of the label so that the processor is switched to Thumb state if the routine is called with a BX instruction.

If a label represents the address of data within a Thumb code area, you do not want the linker to add 1 to the label. The DATA directive marks the label as pointing to data within a code area and the linker does not add 1 to its value.

You can use DATA to mark data-in-code in ARM code areas. The DATA directive is ignored by the assembler in ARM code areas.

Example

			AREA		example, CODE
Thumb_fn			; code
			; code
			MOV		pc, lr
Thumb_Data			DATA
			DCB		1, 3, 4
Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0041C
Non-Confidential