armclang aims to be compatible with GNU syntax assembly code (that is, the assembly code syntax supported by the GNU assembler,
If you have legacy assembly code that
you want to assemble with
armclang, you must convert that assembly code
from ARM syntax to GNU syntax.
The specific instructions and order of operands in your UAL syntax assembly
code do not change during this migration process.
However, you need to make changes to the syntax of your assembly code. These
- The directives in your code.
- The format of labels, comments, and some types of literals.
- Some symbol names.
- The operators in your code.
The following examples show simple, equivalent, assembly code in both ARM and GNU
; Simple ARM syntax example
; Iterate round a loop 10 times, adding 1 to a register each time.
AREA ||.text||, CODE, READONLY, ALIGN=2
MOV w5,#0x64 ; W5 = 100
MOV w4,#0 ; W4 = 0
B test_loop ; branch to test_loop
ADD w5,w5,#1 ; Add 1 to W5
ADD w4,w4,#1 ; Add 1 to W4
CMP w4,#0xa ; if W4 < 10, branch back to loop
// Simple GNU syntax example 4.2 Comments
// Iterate round a loop 10 times, adding 1 to a register each time.
.section .text,"x" // 4.6 Sections
main: // 4.3 Labels
MOV w5,#0x64 // W5 = 100 4.8 Numeric literals
MOV w4,#0 // W4 = 0
B test_loop // branch to test_loop
ADD w5,w5,#1 // Add 1 to W5
ADD w4,w4,#1 // Add 1 to W4
CMP w4,#0xa // if W4 < 10, branch back to loop
.end // 4.15 Miscellaneous directives