Contents|Index|Previous|Next

Symbol Names

Symbol names begin with a letter or with either a dot ( . ) or an underscore ( _ ); on most machines, you can also use $ in symbol names (exceptions are noted in the documentation for particular machines; see Machine Dependent Features). That character may be followed by any string of digits, letters, dollar signs (unless otherwise noted in the documentation for particular machines; see Machine Dependent Features), and underscores. For the AMD 29K family, ? is also allowed in the body of a symbol name, though not at its beginning. Case of letters is significant: foo is a different symbol name than Foo.

Each symbol has exactly one name. Each name in an assembly language program refers to exactly one symbol. You may use that symbol name any number of times in a program.

Local Symbol Names

Local symbols help compilers and programmers use names temporarily. There are ten local symbol names, which are re-used throughout the program. You may refer to them using the names 0 1...9. To define a local symbol, write a label of the form N: (where N represents any digit). To refer to the most recent previous definition of that symbol write N b, using the same digit as when you defined the label. To refer to the next definition of a local label, write N f where N gives you a choice of 10 forward references. The b stands for backwards and the f stands for forwards.

Local symbols are not emitted by the current GNU C compiler.

There is no restriction on how you can use these labels, but remember that at any point in the assembly you can refer to at most 10 prior local labels and to at most 10 forward local labels.

Local symbol names are only a notation device. They are immediately transformed into more conventional symbol names before the assembler uses them. The symbol names stored in the symbol table, appearing in error messages and optionally emitted to the object file have the following parts.

L
All local labels begin with L. Normally both as and ld forget symbols that start with L. These labels are used for symbols you are never intended to see. If you use the -L option then as retains these symbols in the object file. If you also instruct ld to retain these symbols, you may use them in debugging.

digit
If the label is written 0: then the digit is 0. If the label is written 1:, then the digit is 1. So on up through 9:.

A
This unusual character is included so you do not accidentally invent a symbol of the same name. The character has ASCII value \001.

Ordinal number
This is a serial number to keep the labels distinct. The first 0: gets the number 1; The 15th 0: gets the number 15; etc.. Likewise for the other labels 1: through 9:.

For instance, the first 1: is named L1A1, the 44th 3: is named L3A44.