mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 17:12:31 +00:00
55811d8dac
Clang has a completely inconsistent CLI for its integrated assembler for each target architecture. For x86_64, for example, it does not accept an -mcpu parameter, and emits "warning: unused parameter". However, for ARM, -mcpu is needed in order to properly lower assembly to machine code instructions (see new standalone test case provided thanks to @g-w1). This is a compromise betweenb8f85a805b
andafb9f695b1
.
34 lines
434 B
ArmAsm
34 lines
434 B
ArmAsm
.section ".text.boot"
|
|
|
|
.global _start
|
|
|
|
_start:
|
|
mrc p15, #0, r1, c0, c0, #5
|
|
and r1, r1, #3
|
|
cmp r1, #0
|
|
bne halt
|
|
|
|
mov sp, #0x8000
|
|
|
|
ldr r4, =__bss_start
|
|
ldr r9, =__bss_end
|
|
mov r5, #0
|
|
mov r6, #0
|
|
mov r7, #0
|
|
mov r8, #0
|
|
b 2f
|
|
|
|
1:
|
|
stmia r4!, {r5-r8}
|
|
|
|
2:
|
|
cmp r4, r9
|
|
blo 1b
|
|
|
|
ldr r3, =main
|
|
blx r3
|
|
|
|
halt:
|
|
wfe
|
|
b halt
|