From: Kai Tietz Date: Mon, 13 Sep 2010 07:13:35 +0000 (+0000) Subject: 2010-09-13 Kai Tietz X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47c8d350c8567dc02d87b599bfc78bd3d7276c66;p=binutils-gdb.git 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. --- diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 988d0733b4a..83ff1bdf0f4 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 aadf972c7cd..89827197a99 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 00000000000..acfd72767a3 --- /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 00000000000..d43df946b2f --- /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 00000000000..9ec6458a23f --- /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 00000000000..dc132f84733 --- /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 00000000000..8af15ab9e1b --- /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 00000000000..05afabfb867 --- /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