fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / libgloss / fr30 / crt0.s
blobe83a308497d26c812ba519a4e234fe9c6ec4ccc1
1 # FR30 startup code
3 .section .text
4 .global _start
5 _start:
7 ;; Initialise the stack pointer
8 ldi:32 __stack, r0
9 mov r0, sp
10 mov r0, fp
12 ;; Zero the data space
13 ldi:32 #_edata, r0
14 ldi:32 #_end, r1
15 ldi:8 #0, r2
16 .L0:
17 st r2, @r0
18 add #4, r0
19 cmp r1, r0
20 blt .L0
22 ;; Call global and static constructors
23 ldi:32 _init, r0
24 call @r0
26 ;; Setup destrcutors to be called from exit.
27 ;; (Just in case main never returns....)
28 ldi:32 atexit, r0
29 ldi:32 _fini, r4
30 call @r0
32 ;; Initialise argc, argv and envp to empty
33 ldi:8 #0, r4
34 ldi:8 #0, r5
35 ldi:8 #0, r6
37 ;; Call main
38 ldi:32 main, r0
39 call @r0
41 ;; Jump to exit
42 ldi:32 exit, r0
43 call @r0
45 ;; Should never reach here
46 int #9