Defining A Symbol In Asswmbaly Language

On

Technical Support

On-Line Manuals

Assembler User Guide

Symbol names are case-sensitive, and all characters in the symbol name are significant. Do not use numeric characters for the first character of symbol names, except in numeric local labels. Symbols must not use the same name as built-in variable names or predefined symbol names.

PrefaceOverview of the AssemblerOverview of the ARM ArchitectureStructure of Assembly Language ModulesWriting ARM Assembly LanguageCondition CodesUsing the AssemblerSymbols, Literals, Expressions, and OperatorsSymbol naming rulesVariablesNumeric constantsAssembly time substitution of variablesRegister-relative and PC-relative expressionsLabelsLabels for PC-relative addressesLabels for register-relative addressesLabels for absolute addressesNumeric local labelsLanguage

Assembly Language Symbol Table

Syntax of numeric local labelsString expressionsString literalsNumeric expressionsSyntax of numeric literalsSyntax of floating-point literalsLogical expressionsLogical literalsUnary operatorsBinary operatorsMultiplicative operatorsString manipulation operatorsShift operatorsAddition, subtraction, and logical operatorsRelational operatorsBoolean operatorsOperator precedenceDifference between operator precedence in assemblyVFP ProgrammingAssembler Command-line OptionsARM and Thumb InstructionsVFP InstructionsDirectives ReferenceVia File Syntax
Non-Confidential PDF versionARM DUI0379H
ARM® Compiler v5.06 for µVision®armasm User GuideVersion 5

7.1 Symbol naming rules

You must follow some rules when naming symbols in assembly language source code.

  • Symbol names must be unique within their scope.
  • You can use uppercase letters, lowercase letters, numeric characters, or the underscore character in symbol names. Symbol names are case-sensitive, and all characters in the symbol name are significant.
  • Do not use numeric characters for the first character of symbol names, except in numeric local labels.
  • Symbols must not use the same name as built-in variable names or predefined symbol names.
  • If you use the same name as an instruction mnemonic or directive, use double bars to delimit the symbol name. For example:
    The bars are not part of the symbol.
  • You must not use the symbols $t , $t.x , or $d as program labels. These are mapping symbols that mark the beginning of Thumb, ThumbEE, and data within the object file.
  • Symbols beginning with the characters $v are mapping symbols that relate to VFP and might be output when building for a target with VFP. ARM recommends you avoid using symbols beginning with $v in your source code.
If you have to use a wider range of characters in symbols, for example, when working with compilers, use single bars to delimit the symbol name. For example:
The bars are not part of the symbol. You cannot use bars, semicolons, or newlines within the bars.
Related concepts
Related reference
Non-Confidential PDF versionARM DUI0379H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved.

Products

Development Tools
Hardware & Collateral

Downloads

Support

Contact

Cookie Settings Terms of Use Privacy Accessibility Trademarks Contact Us Feedback

Copyright © 2005-2019 Arm Limited (or its affiliates). All rights reserved.

Values and Symbol Types

This section presents the values and symbol types that the assembler uses.

Values

Values are represented in the assembler by numerals which can be faithfully represented in standard two's complement binary positional notation using 32 bits. All integer arithmetic is performed using 32 bits of precision. Note, however, that the values used in an IA--32 instruction may require 8, 16, or 32 bits.

Symbols

A symbol has a value and a symbol type, each of which is either specified explicitly by an assignment statement or implicitly from context. Refer to the next section for the regular definition of the expressions of a symbol.

The following symbols are reserved by the assembler:

.Commonly referred to as dot. This is the location counter while assembling a program. It takes on the current location in the text, data, or bss section.


.text

This symbol is of type text. It is used to label the beginning of a .text section in the program being assembled.


.data

This symbol is of type data. It is used to label the beginning of a data section in the program being assembled.


.bss

This symbol is of type bss. It is used to label the beginning of a .bss section in the program being assembled.


.init

This is used with C++ programs which require constructors.


.fini

This is used with C++ programs which require destructors.

Symbol Types

Symbol type is one of the following:


undefined

A value is of undefined symbol type if it has not yet been defined. Example instances of undefined symbol types are forward references and externals.


absolute

A value is of absolute symbol type it does not change with relocation. Example instances of absolute symbol types are numeric constants and expressions whose proper sub-expressions are themselves all absolute.


text

A value is of text symbol type if it is relative to the .text section.


data

A value is of data symbol type if it is relative to the .data section.


bss

A value is of bss symbol type if it is relative to the .bss section.

You can give any of these symbol types the attribute EXTERNAL.

Essays About Language Defining Us

Sections

Five of the symbol types are defined with respect to certain sections of the object file into which the assembler translates the source file. This section describes symbol types.

If the assembler translates a particular assembly language statement into a machine language instruction or into a data allocation, the translation is associated with one of the following five sections of the object file into which the assembler is translating the source file:

Table 1-1 Translations and their Associations

Section

Purpose

text

This is an initialized section. Normally, it is read-only and contains code from a program. It may also contain read-only tables

data

This is an initialized section. Normally, it is readable and writable. It contains initialized data. These can be scalars or tables.

bss

This is an initialized section. Space is not allocated for this segment in the object file.

init

This is used with C++ programs that require constructors.

fini

This is used by C++ programs that require destructors.

An optional section, .comment, may also be produced.

The section associated with the translated statement is .text unless the original statement occurs after a section control pseudo operation has directed the assembler to associate the statement with another section.