From: Alan Modra Date: Tue, 20 May 2003 08:01:19 +0000 (+0000) Subject: * gas/cfi/cfi.exp: Testsuite for cfi machinery. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ebaa23b7a465e6fd59ee435c7436c532ac2e910;p=binutils-gdb.git * gas/cfi/cfi.exp: Testsuite for cfi machinery. * gas/cfi/cfi-x86_64.[sd]: Files for x86-64. * gas/cfi/cfi-i386.[sd]: Files for i386. --- diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index f203b395218..69dd0a61a5f 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2003-05-20 Michal Ludvig + + * gas/cfi/cfi.exp: Testsuite for cfi machinery. + * gas/cfi/cfi-x86_64.[sd]: Files for x86-64. + * gas/cfi/cfi-i386.[sd]: Files for i386. + 2003-05-19 Thiemo Seufer * gas/mips/mips.exp: mips-*-linux-*, mipsel-*-linux-* use only 32-bit @@ -37,7 +43,7 @@ * gas/ia64/ia64.exp: Add alias. - * gas/ia64/alias.s: New. + * gas/ia64/alias.s: New. * gas/ia64/alias.d: Likewise. 2003-05-06 Alexandre Oliva @@ -174,8 +180,8 @@ 2003-04-29 Nick Clifton * gas/elf/elf.exp: Invoke symver test. - * gas/elf/symver.s: New test case. - * gas/elf/symver.d: Expected output. + * gas/elf/symver.s: New test case. + * gas/elf/symver.d: Expected output. 2003-04-24 Nick Clifton @@ -198,8 +204,8 @@ 2003-04-08 Nick Clifton * gas/m32r/m32r.exp: Run signed-relocs test. - * gas/m32r/signed-relocs.s: New file: Test signed relocs. - * gas/m32r/signed-relocs.d: New file: Expected results + * gas/m32r/signed-relocs.s: New file: Test signed relocs. + * gas/m32r/signed-relocs.d: New file: Expected results * gas/ia64/dependency-1.s: New file: Test read before write dependency. * gas/ia64/dependency-1.d: New file: Expected assembly results. @@ -253,17 +259,17 @@ 2003-04-01 Bob Wilson - * gas/xtensa/all.exp: New file. - * gas/xtensa/entry_align.s: Likewise. - * gas/xtensa/entry_misalign2.s: Likewise. - * gas/xtensa/entry_misalign.s: Likewise. - * gas/xtensa/j_too_far.s: Likewise. - * gas/xtensa/loop_align.s: Likewise. - * gas/xtensa/loop_misalign.s: Likewise. + * gas/xtensa/all.exp: New file. + * gas/xtensa/entry_align.s: Likewise. + * gas/xtensa/entry_misalign2.s: Likewise. + * gas/xtensa/entry_misalign.s: Likewise. + * gas/xtensa/j_too_far.s: Likewise. + * gas/xtensa/loop_align.s: Likewise. + * gas/xtensa/loop_misalign.s: Likewise. 2003-03-25 Stan Cox Nick Clifton - + Contribute support for Intel's iWMMXt chip - an ARM variant: * gas/arm/arm.exp: Run iwmmxt test. @@ -300,14 +306,14 @@ * gas/all/test-gen.c: New file: Framework for automatically generating assembler test files. - * gas/all/test-examples.c: New file: Example of a file using + * gas/all/test-examples.c: New file: Example of a file using test-gen.c. - * gas/arm/maverick.c: Rework to produce correct test files and + * gas/arm/maverick.c: Rework to produce correct test files and fix formatting. - * gas/arm/maverick.s: Regenerate. - * gas/arm/maverick.d: Regenerate. - * gas/arm/arm.exp: Always run Maverick tests. + * gas/arm/maverick.s: Regenerate. + * gas/arm/maverick.d: Regenerate. + * gas/arm/arm.exp: Always run Maverick tests. 2003-02-21 Richard Sandiford @@ -486,8 +492,8 @@ 2002-12-20 Chris Demetriou - * lib/gas-defs.exp (run_dump_test): Add a new optional argument, - "extra_options". + * lib/gas-defs.exp (run_dump_test): Add a new optional argument, + "extra_options". 2002-12-18 Chris Demetriou @@ -550,8 +556,8 @@ 2002-12-05 Jim Wilson - * gas/ia64/opc-x.d: Regenerate. - + * gas/ia64/opc-x.d: Regenerate. + 2002-12-05 Alan Modra * gas/arm/adrl.s: Pad end of .text. @@ -631,7 +637,7 @@ * gas/xstormy16/allinsn.sh: Add sdiv, divlh, and sdivlh. * gas/xstormy16/allinsn.d: Regenerate. * gas/xstormy16/allinsn.s: Regenerate. - + 2002-11-18 Svein E. Seldal * gas/all/gas.exp: Setup for tic4x testcase diff --git a/gas/testsuite/gas/cfi/cfi-i386.d b/gas/testsuite/gas/cfi/cfi-i386.d new file mode 100644 index 00000000000..d27a69b42b9 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-i386.d @@ -0,0 +1,101 @@ +#readelf: -wf +#name: CFI on i386 + +The section .eh_frame contains: + +00000000 00000010 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + + DW_CFA_def_cfa: r7 ofs 4 + DW_CFA_offset: r8 at cfa-4 + DW_CFA_nop + DW_CFA_nop + +00000014 00000014 00000018 FDE cie=00000000 pc=00000000..00000012 + DW_CFA_advance_loc: 6 to 00000006 + DW_CFA_def_cfa_offset: 4664 + DW_CFA_advance_loc: 11 to 00000011 + DW_CFA_def_cfa_offset: 4 + DW_CFA_nop + +0000002c 00000010 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + + DW_CFA_def_cfa: r7 ofs 4 + DW_CFA_offset: r8 at cfa-4 + DW_CFA_nop + DW_CFA_nop + +00000040 00000018 00000018 FDE cie=0000002c pc=00000012..0000001f + DW_CFA_advance_loc: 1 to 00000013 + DW_CFA_def_cfa_offset: 8 + DW_CFA_offset: r6 at cfa-8 + DW_CFA_advance_loc: 2 to 00000015 + DW_CFA_def_cfa_reg: r6 + DW_CFA_advance_loc: 9 to 0000001e + DW_CFA_def_cfa_reg: r7 + DW_CFA_nop + +0000005c 00000010 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + + DW_CFA_def_cfa: r7 ofs 4 + DW_CFA_offset: r8 at cfa-4 + DW_CFA_nop + DW_CFA_nop + +00000070 00000014 00000018 FDE cie=0000005c pc=0000001f..0000002f + DW_CFA_advance_loc: 2 to 00000021 + DW_CFA_def_cfa_reg: r1 + DW_CFA_advance_loc: 13 to 0000002e + DW_CFA_def_cfa: r7 ofs 4 + DW_CFA_nop + +00000088 00000010 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + + DW_CFA_def_cfa: r7 ofs 4 + DW_CFA_offset: r8 at cfa-4 + DW_CFA_nop + DW_CFA_nop + +0000009c 00000010 00000018 FDE cie=00000088 pc=0000002f..00000035 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +000000b0 00000010 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + + DW_CFA_def_cfa: r7 ofs 4 + DW_CFA_offset: r8 at cfa-4 + DW_CFA_nop + DW_CFA_nop + +000000c4 00000010 00000018 FDE cie=000000b0 pc=00000035..00000044 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + diff --git a/gas/testsuite/gas/cfi/cfi-i386.s b/gas/testsuite/gas/cfi/cfi-i386.s new file mode 100644 index 00000000000..afaafabd790 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-i386.s @@ -0,0 +1,107 @@ +#; $ as -o test.o gas-cfi-test.s && gcc -nostdlib -o test test.o + + .text + +#; func_locvars +#; - function with a space on the stack +#; allocated for local variables + + .type func_locvars,@function +func_locvars: + .cfi_startproc + + #; alocate space for local vars + sub $0x1234,%esp + .cfi_adjust_cfa_offset 0x1234 + + #; dummy body + movl $1,%eax + + #; release space of local vars and return + add $0x1234,%esp + .cfi_adjust_cfa_offset -0x1234 + ret + .cfi_endproc + +#; func_prologue +#; - functions that begins with standard +#; prologue: "pushq %rbp; movq %rsp,%rbp" + + .type func_prologue,@function +func_prologue: + .cfi_startproc + + #; prologue, CFI is valid after + #; each instruction. + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset ebp,-8 + movl %esp, %ebp + .cfi_def_cfa_register ebp + + #; function body + call func_locvars + addl $3, %eax + + #; epilogue with valid CFI + #; (we're better than gcc :-) + leave + .cfi_def_cfa_register esp + ret + .cfi_endproc + +#; func_otherreg +#; - function that moves frame pointer to +#; another register (r12) and then allocates +#; a space for local variables + + .type func_otherreg,@function +func_otherreg: + .cfi_startproc + + #; save frame pointer to ebx + mov %esp,%ebx + .cfi_def_cfa_register ebx + + #; alocate space for local vars + #; (no .cfi_{def,adjust}_cfa_offset here, + #; because CFA is computed from r12!) + sub $100,%esp + + #; function body + call func_prologue + add $2, %eax + + #; restore frame pointer from r12 + mov %ebx,%esp + .cfi_def_cfa esp,4 + ret + .cfi_endproc + +#; main +#; - typical function + .type main,@function +main: + .cfi_startproc + + #; only function body that doesn't + #; touch the stack at all. + call func_otherreg + + #; return + ret + .cfi_endproc + +#; _start +#; - standard entry point + + .type _start,@function + .globl _start +_start: + .cfi_startproc + call main + movl %eax,%edi + movl $0x1,%eax + int $0x80 + hlt + .cfi_endproc diff --git a/gas/testsuite/gas/cfi/cfi-x86_64.d b/gas/testsuite/gas/cfi/cfi-x86_64.d new file mode 100644 index 00000000000..b4b99abc780 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-x86_64.d @@ -0,0 +1,133 @@ +#readelf: -wf +#name: CFI on x86-64 + +The section .eh_frame contains: + +00000000 00000014 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + + DW_CFA_def_cfa: r7 ofs 8 + DW_CFA_offset: r16 at cfa-8 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +00000018 0000001c 0000001c FDE cie=00000000 pc=00000000..00000014 + DW_CFA_advance_loc: 7 to 00000007 + DW_CFA_def_cfa_offset: 4668 + DW_CFA_advance_loc: 12 to 00000013 + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +00000038 00000014 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + + DW_CFA_def_cfa: r7 ofs 8 + DW_CFA_offset: r16 at cfa-8 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +00000050 00000024 0000001c FDE cie=00000038 pc=00000000..0000000f + DW_CFA_advance_loc: 1 to 00000001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 at cfa-16 + DW_CFA_advance_loc: 3 to 00000004 + DW_CFA_def_cfa_reg: r6 + DW_CFA_advance_loc: 10 to 0000000e + DW_CFA_def_cfa: r7 ofs 8 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +00000078 00000014 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + + DW_CFA_def_cfa: r7 ofs 8 + DW_CFA_offset: r16 at cfa-8 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +00000090 0000001c 0000001c FDE cie=00000078 pc=00000000..00000013 + DW_CFA_advance_loc: 3 to 00000003 + DW_CFA_def_cfa_reg: r12 + DW_CFA_advance_loc: 15 to 00000012 + DW_CFA_def_cfa_reg: r7 + DW_CFA_nop + DW_CFA_nop + +000000b0 00000014 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + + DW_CFA_def_cfa: r7 ofs 8 + DW_CFA_offset: r16 at cfa-8 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +000000c8 0000001c 0000001c FDE cie=000000b0 pc=00000000..00000006 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +000000e8 00000014 00000000 CIE + Version: 1 + Augmentation: "" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + + DW_CFA_def_cfa: r7 ofs 8 + DW_CFA_offset: r16 at cfa-8 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +00000100 0000001c 0000001c FDE cie=000000e8 pc=00000000..00000012 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + diff --git a/gas/testsuite/gas/cfi/cfi-x86_64.s b/gas/testsuite/gas/cfi/cfi-x86_64.s new file mode 100644 index 00000000000..10035ad7f8f --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-x86_64.s @@ -0,0 +1,107 @@ +#; $ as -o test.o gas-cfi-test.s && gcc -nostdlib -o test test.o + + .text + +#; func_locvars +#; - function with a space on the stack +#; allocated for local variables + + .type func_locvars,@function +func_locvars: + .cfi_startproc + + #; alocate space for local vars + sub $0x1234,%rsp + .cfi_adjust_cfa_offset 0x1234 + + #; dummy body + movl $1,%eax + + #; release space of local vars and return + add $0x1234,%rsp + .cfi_adjust_cfa_offset -0x1234 + ret + .cfi_endproc + +#; func_prologue +#; - functions that begins with standard +#; prologue: "pushq %rbp; movq %rsp,%rbp" + + .type func_prologue,@function +func_prologue: + .cfi_startproc + + #; prologue, CFI is valid after + #; each instruction. + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset rbp,-16 + movq %rsp, %rbp + .cfi_def_cfa_register rbp + + #; function body + call func_locvars + addl $3, %eax + + #; epilogue with valid CFI + #; (we're better than gcc :-) + leaveq + .cfi_def_cfa rsp,8 + ret + .cfi_endproc + +#; func_otherreg +#; - function that moves frame pointer to +#; another register (r12) and then allocates +#; a space for local variables + + .type func_otherreg,@function +func_otherreg: + .cfi_startproc + + #; save frame pointer to r12 + movq %rsp,%r12 + .cfi_def_cfa_register r12 + + #; alocate space for local vars + #; (no .cfi_{def,adjust}_cfa_offset here, + #; because CFA is computed from r12!) + sub $100,%rsp + + #; function body + call func_prologue + addl $2, %eax + + #; restore frame pointer from r12 + movq %r12,%rsp + .cfi_def_cfa_register rsp + ret + .cfi_endproc + +#; main +#; - typical function + .type main,@function +main: + .cfi_startproc + + #; only function body that doesn't + #; touch the stack at all. + call func_otherreg + + #; return + ret + .cfi_endproc + +#; _start +#; - standard entry point + + .type _start,@function + .globl _start +_start: + .cfi_startproc + call main + movq %rax,%rdi + movq $0x3c,%rax + syscall + hlt + .cfi_endproc diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp new file mode 100644 index 00000000000..4d1b95d7889 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi.exp @@ -0,0 +1,7 @@ +if [istarget "x86_64-*"] then { + run_dump_test "cfi-x86_64" +} + +if [istarget "i?86-*"] then { + run_dump_test "cfi-i386" +}