1#; $ as -o test.o gas-cfi-test.s && gcc -nostdlib -o test test.o
2
3	.text
4
5#; func_locvars
6#; - function with a space on the stack
7#;   allocated for local variables
8
9	.type	func_locvars,@function
10func_locvars:
11	.cfi_startproc
12
13	#; alocate space for local vars
14	suba.w	#0x1234,%sp
15	.cfi_adjust_cfa_offset	0x1234
16
17	#; dummy body
18	moveq.l	#1,%d0
19
20	#; release space of local vars and return
21	adda.w	#0x1234,%sp
22	.cfi_adjust_cfa_offset	-0x1234
23	rts
24	.cfi_endproc
25
26#; func_prologue
27#; - functions that begins with standard
28#;   prologue: "link %a6,#0"
29
30	.type	func_prologue,@function
31func_prologue:
32	.cfi_startproc
33
34	#; prologue, CFI is valid after
35	#; each instruction.
36	link	%a6,#0
37	.cfi_def_cfa_offset	8
38	.cfi_offset		a6,-8
39	.cfi_def_cfa_register	a6
40
41	#; function body
42	jbsr	func_locvars
43	addq.l	#3, %d0
44
45	#; epilogue with valid CFI
46	#; (we're better than gcc :-)
47	unlk	%a6
48	.cfi_def_cfa_register	sp
49	rts
50	.cfi_endproc
51
52#; main
53#; - typical function
54	.type	main,@function
55main:
56	.cfi_startproc
57
58	#; only function body that doesn't
59	#; touch the stack at all.
60	jbsr	func_prologue
61
62	#; return
63	rts
64	.cfi_endproc
65