GNU-style Arm Assembly syntax Guide (very detailed) 2

Source: Internet
Author: User

Conversion from: GNU-style Arm Assembly syntax Guide (very detailed) 2

2. the symbol (or label) in the GNU Assembler)

The label can only be ~ Z, ~ Z, 0 ~ 9,".", _, And so on (it consists of dots, letters, numbers, underscores, and so on. It cannot start with a number except for a local number.

The essence of Symbol: it represents the address where it is located. Therefore, it can be used as a variable or function.

The address value of the label in the L segment is determined during assembly;

The address value of the non-CIDR block is determined during connection.

Symbol classification: three types (based on the Generation Method of the number ).

<1>PC-based labels. The PC-based label is the label located before the target instruction or before the pseudo operation is defined in the program data. This label will be processed as a PC value plus (or minus) a numerical constant during assembly, which is often used to indicate a jump command"B"Or a small amount of data embedded in the code segment.

<2>Register-based labels. Register-based labels are commonly defined by map and field, and can also be defined by equ. This label is often used to access data in the data segment by adding (or subtracting) a numerical constant to the value processed into a register during assembly.

<3>Absolute address. The absolute address is a 32-bit data. It can address a range of [0,232-1], that is, it can directly address the entire memory space.

 

Note:Local symbol

Local labels are mainly used in a local range and can be repeated. It consists of two parts: It starts with a number 0-99, followed by a symbol that usually represents the scope of the local variable. The range of local variables is usually the current segment.RoutTo define the scope of the local variable.

Syntax format defined by local variables:N {routname}

L n: 0 ~ A number between 99.

L routname: name of the current local range (as a symbol), usually the name of the scope of the variable (defined by the rout pseudo operation ).

Syntax format of local variable reference:% {F | B} {A | t} n {routname}

L %: indicates the reference operation.

L n: the number of the local variable.

L routname: name of the current range (defined by the rout pseudo operation)

L f: indicates that the compiler only searches forward.

L B: indicates that the compiler only searches backward.

L a: indicates the compiler to search for all nested layers of macros.

L t: indicates the compiler to search for the current macro level.

Example: Use a local symbol.

1:

Subs r0, R0, #1 @ each loop to make R0 = r0-1

BNE 1f @ jump to 1 to execute

 

Note:

L if neither f nor B is specified, the compiler first searches forward and then backward.

L if neither a nor T is specified, the compiler searches for all the highest levels from the current level to the macro level and does not search for any lower levels than the current level.

L if routname is specified, the compiler searches forward for the most recent rout pseudo operation. If routname does not match the name defined in the rout pseudo operation, the compiler reports an error and fails to compile.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.