From 1a12449a0157cd8ca1b43d0cf4b130f093d860af Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Mon, 13 Sep 2010 07:13:34 +0000 Subject: [PATCH] 2010-09-13 Kai Tietz * gas/pe/pe.exp: Add x64 SEH tests. * gas/pe/peseh-x64.s: New. * gas/pe/peseh-x64.d: New. * gas/pe/peseh-x64-2.s: New. * gas/pe/peseh-x64-2.d: New. * gas/pe/peseh-x64-3.s: New. * gas/pe/peseh-x64-3.d: New. --- gas/testsuite/ChangeLog | 10 ++++++++++ gas/testsuite/gas/pe/pe.exp | 10 ++++++++++ gas/testsuite/gas/pe/peseh-x64-2.d | 7 +++++++ gas/testsuite/gas/pe/peseh-x64-2.s | 26 ++++++++++++++++++++++++++ gas/testsuite/gas/pe/peseh-x64-3.d | 9 +++++++++ gas/testsuite/gas/pe/peseh-x64-3.s | 31 +++++++++++++++++++++++++++++++ gas/testsuite/gas/pe/peseh-x64.d | 7 +++++++ gas/testsuite/gas/pe/peseh-x64.s | 14 ++++++++++++++ 8 files changed, 114 insertions(+) create mode 100644 gas/testsuite/gas/pe/peseh-x64-2.d create mode 100644 gas/testsuite/gas/pe/peseh-x64-2.s create mode 100644 gas/testsuite/gas/pe/peseh-x64-3.d create mode 100644 gas/testsuite/gas/pe/peseh-x64-3.s create mode 100644 gas/testsuite/gas/pe/peseh-x64.d create mode 100644 gas/testsuite/gas/pe/peseh-x64.s diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 988d0733b..83ff1bdf0 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-09-13 Kai Tietz + + * gas/pe/pe.exp: Add x64 SEH tests. + * gas/pe/peseh-x64.s: New. + * gas/pe/peseh-x64.d: New. + * gas/pe/peseh-x64-2.s: New. + * gas/pe/peseh-x64-2.d: New. + * gas/pe/peseh-x64-3.s: New. + * gas/pe/peseh-x64-3.d: New. + 2010-09-09 Nick Clifton PR gas/11973 diff --git a/gas/testsuite/gas/pe/pe.exp b/gas/testsuite/gas/pe/pe.exp index aadf972c7..89827197a 100755 --- a/gas/testsuite/gas/pe/pe.exp +++ b/gas/testsuite/gas/pe/pe.exp @@ -35,3 +35,13 @@ run_dump_test "aligncomm-d" run_dump_test "section-align-1" run_dump_test "section-align-3" + +# SEH related tests + +# These tests are only for x86_64 targets +if ([istarget "x86_64-*-mingw*"]) then { + + run_dump_test "peseh-x64" + run_dump_test "peseh-x64-2" + run_dump_test "peseh-x64-3" +} diff --git a/gas/testsuite/gas/pe/peseh-x64-2.d b/gas/testsuite/gas/pe/peseh-x64-2.d new file mode 100644 index 000000000..acfd72767 --- /dev/null +++ b/gas/testsuite/gas/pe/peseh-x64-2.d @@ -0,0 +1,7 @@ +#objdump: -s -j .xdata +#name: PE x64 SEH test 2 + +.*: .* + +Contents of section .xdata: + 0000 01080305 08320403 01500000 .* diff --git a/gas/testsuite/gas/pe/peseh-x64-2.s b/gas/testsuite/gas/pe/peseh-x64-2.s new file mode 100644 index 000000000..d43df946b --- /dev/null +++ b/gas/testsuite/gas/pe/peseh-x64-2.s @@ -0,0 +1,26 @@ + .file "t2.c" + .text + .p2align 4,,15 + .globl foo + .def foo; .scl 2; .type 32; .endef + .seh_proc foo +foo: + pushq %rbp + .seh_pushreg %rbp + movq %rsp, %rbp + .seh_setframe %rbp, 0 + subq $32, %rsp + .seh_stackalloc 32 + .seh_endprologue + leal 1(%rcx), %eax + cltq + addq $30, %rax + andq $-16, %rax + call ___chkstk + leaq 32(%rsp), %rcx + call bar + movq %rbp, %rsp + popq %rbp + ret + .seh_endproc + .def bar; .scl 2; .type 32; .endef diff --git a/gas/testsuite/gas/pe/peseh-x64-3.d b/gas/testsuite/gas/pe/peseh-x64-3.d new file mode 100644 index 000000000..9ec6458a2 --- /dev/null +++ b/gas/testsuite/gas/pe/peseh-x64-3.d @@ -0,0 +1,9 @@ +#objdump: -s -j .xdata +#name: PE x64 SEH test 3 + +.*: .* + +Contents of section .xdata: + 0000 09080305 08520403 01500000 00000000 .....R...P...... + 0010 01000000 0f000000 1c000000 00000000 ................ + 0020 1c000000 .* diff --git a/gas/testsuite/gas/pe/peseh-x64-3.s b/gas/testsuite/gas/pe/peseh-x64-3.s new file mode 100644 index 000000000..dc132f847 --- /dev/null +++ b/gas/testsuite/gas/pe/peseh-x64-3.s @@ -0,0 +1,31 @@ + .file "t3.c" + .text + .globl nMainCRTStartup + .def nMainCRTStartup; .scl 2; .type 32; .endef + .seh_proc nMainCRTStartup +nMainCRTStartup: + pushq %rbp + .seh_pushreg %rbp + movq %rsp, %rbp + .seh_setframe %rbp, 0 + subq $48, %rsp + .seh_stackalloc 48 + .seh_endprologue + movl $255, -4(%rbp) +.l_startw: + .seh_handler __C_specific_handler, @except + .seh_handlerdata + .long 1 + .rva .l_startw, .l_endw, _gnu_exception_handler ,.l_endw + .text + call __security_init_cookie + call __tmainCRTStartup + movl %eax, -4(%rbp) +.l_endw: nop + movl -4(%rbp), %eax + addq $48, %rsp + popq %rbp + ret + .seh_endproc + .def __security_init_cookie; .scl 2; .type 32; .endef + .def __tmainCRTStartup; .scl 2; .type 32; .endef diff --git a/gas/testsuite/gas/pe/peseh-x64.d b/gas/testsuite/gas/pe/peseh-x64.d new file mode 100644 index 000000000..8af15ab9e --- /dev/null +++ b/gas/testsuite/gas/pe/peseh-x64.d @@ -0,0 +1,7 @@ +#objdump: -s -j .xdata +#name: PE x64 SEH test 1 + +.*: .* + +Contents of section .xdata: + 0000 01040100 04020000 .* diff --git a/gas/testsuite/gas/pe/peseh-x64.s b/gas/testsuite/gas/pe/peseh-x64.s new file mode 100644 index 000000000..05afabfb8 --- /dev/null +++ b/gas/testsuite/gas/pe/peseh-x64.s @@ -0,0 +1,14 @@ + .file "t1.c" + .text + .p2align 4,,15 + .globl foo + .def foo; .scl 2; .type 32; .endef + .seh_proc foo +foo: + subq $8, %rsp + .seh_stackalloc 8 + .seh_endprologue + movl $1, %eax + addq $8, %rsp + ret + .seh_endproc -- 2.11.4.GIT