#; $ as -o test.o gas-cfi-test.s && gcc -nostdlib -o test test.o
|
#; $ as -o test.o gas-cfi-test.s && gcc -nostdlib -o test test.o
|
|
|
.text
|
.text
|
|
|
#; func_locvars
|
#; func_locvars
|
#; - function with a space on the stack
|
#; - function with a space on the stack
|
#; allocated for local variables
|
#; allocated for local variables
|
|
|
.type func_locvars,@function
|
.type func_locvars,@function
|
func_locvars:
|
func_locvars:
|
.cfi_startproc
|
.cfi_startproc
|
|
|
#; alocate space for local vars
|
#; alocate space for local vars
|
suba.w #0x1234,%sp
|
suba.w #0x1234,%sp
|
.cfi_adjust_cfa_offset 0x1234
|
.cfi_adjust_cfa_offset 0x1234
|
|
|
#; dummy body
|
#; dummy body
|
moveq.l #1,%d0
|
moveq.l #1,%d0
|
|
|
#; release space of local vars and return
|
#; release space of local vars and return
|
adda.w #0x1234,%sp
|
adda.w #0x1234,%sp
|
.cfi_adjust_cfa_offset -0x1234
|
.cfi_adjust_cfa_offset -0x1234
|
rts
|
rts
|
.cfi_endproc
|
.cfi_endproc
|
|
|
#; func_prologue
|
#; func_prologue
|
#; - functions that begins with standard
|
#; - functions that begins with standard
|
#; prologue: "link %a6,#0"
|
#; prologue: "link %a6,#0"
|
|
|
.type func_prologue,@function
|
.type func_prologue,@function
|
func_prologue:
|
func_prologue:
|
.cfi_startproc
|
.cfi_startproc
|
|
|
#; prologue, CFI is valid after
|
#; prologue, CFI is valid after
|
#; each instruction.
|
#; each instruction.
|
link %a6,#0
|
link %a6,#0
|
.cfi_def_cfa_offset 8
|
.cfi_def_cfa_offset 8
|
.cfi_offset a6,-8
|
.cfi_offset a6,-8
|
.cfi_def_cfa_register a6
|
.cfi_def_cfa_register a6
|
|
|
#; function body
|
#; function body
|
jbsr func_locvars
|
jbsr func_locvars
|
addq.l #3, %d0
|
addq.l #3, %d0
|
|
|
#; epilogue with valid CFI
|
#; epilogue with valid CFI
|
#; (we're better than gcc :-)
|
#; (we're better than gcc :-)
|
unlk %a6
|
unlk %a6
|
.cfi_def_cfa_register sp
|
.cfi_def_cfa_register sp
|
rts
|
rts
|
.cfi_endproc
|
.cfi_endproc
|
|
|
#; main
|
#; main
|
#; - typical function
|
#; - typical function
|
.type main,@function
|
.type main,@function
|
main:
|
main:
|
.cfi_startproc
|
.cfi_startproc
|
|
|
#; only function body that doesn't
|
#; only function body that doesn't
|
#; touch the stack at all.
|
#; touch the stack at all.
|
jbsr func_prologue
|
jbsr func_prologue
|
|
|
#; return
|
#; return
|
rts
|
rts
|
.cfi_endproc
|
.cfi_endproc
|
|
|