fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / binutils / ld / testsuite / ld-m68hc11 / far-hc12.s
blob0081e3876976f6690e28282f8a378cf8aae157f2
1 ;;; Test 68HC12 FAR trampoline generation
2 ;;; 2 trampolines are generated:
3 ;;; - one for '_far_bar'
4 ;;; - one for '_far_foo'
5 ;;; 'far_no_tramp' does not have any trampoline generated.
6 ;;;
7 .sect .text
8 .globl _start
9 _start:
10 start:
11 lds #stack-1
12 ldx #0xabcd
13 pshx
14 ldd #0x1234
15 ldx #0x5678
16 bsr _far_bar ; Call to trampoline generated code
17 cpx #0x1234
18 bne fail ; X and D preserved (swapped by _far_bar)
19 cpd #0x5678
20 bne fail
21 pulx
22 cpx #0xabcd ; Stack parameter preserved
23 bne fail
24 ldd #_far_foo ; Get address of trampoline handler
25 xgdx
26 jsr 0,x
27 ldd #_far_bar ; Likewise (unique trampoline check)
28 xgdy
29 jsr 0,y
30 call _far_no_tramp ; No trampoline generated for _far_no_tramp
31 clra
32 clrb
33 wai
34 fail:
35 ldd #1
36 wai
37 bra start
39 .sect .bank1,"ax"
40 .globl _far_bar
41 .far _far_bar ; Must mark symbol as far
42 _far_bar:
43 jsr local_bank1
44 xgdx
45 rtc
47 local_bank1:
48 rts
50 .sect .bank2,"ax"
51 .globl _far_foo
52 .far _far_foo
53 _far_foo:
54 jsr local_bank2
55 rtc
57 local_bank2:
58 rts
60 .sect .bank3,"ax"
61 .globl _far_no_tramp
62 .far _far_no_tramp
63 _far_no_tramp:
64 jsr local_bank3
65 rtc
67 local_bank3:
68 rts
70 .sect .text
71 .globl __far_trampoline
72 __far_trampoline:
73 movb 0,sp, 2,sp ; Copy page register below the caller's return
74 leas 2,sp ; address.
75 jmp 0,y ; We have a 'call/rtc' stack layout now
76 ; and can jump to the far handler
77 ; (whose memory bank is mapped due to the
78 ; call to the trampoline).
80 .sect .bss
81 .skip 100
82 stack: