2010-09-13 Kai Tietz <kai.tietz@onevision.com>
authorKai Tietz <kai.tietz@onevision.com>
Mon, 13 Sep 2010 07:13:35 +0000 (07:13 +0000)
committerKai Tietz <kai.tietz@onevision.com>
Mon, 13 Sep 2010 07:13:35 +0000 (07:13 +0000)
        * 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
gas/testsuite/gas/pe/pe.exp
gas/testsuite/gas/pe/peseh-x64-2.d [new file with mode: 0644]
gas/testsuite/gas/pe/peseh-x64-2.s [new file with mode: 0644]
gas/testsuite/gas/pe/peseh-x64-3.d [new file with mode: 0644]
gas/testsuite/gas/pe/peseh-x64-3.s [new file with mode: 0644]
gas/testsuite/gas/pe/peseh-x64.d [new file with mode: 0644]
gas/testsuite/gas/pe/peseh-x64.s [new file with mode: 0644]

index 988d073..83ff1bd 100644 (file)
@@ -1,3 +1,13 @@
+2010-09-13  Kai Tietz  <kai.tietz@onevision.com>
+
+       * 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  <nickc@redhat.com>
 
        PR gas/11973
index aadf972..8982719 100755 (executable)
@@ -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 (file)
index 0000000..acfd727
--- /dev/null
@@ -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 (file)
index 0000000..d43df94
--- /dev/null
@@ -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 (file)
index 0000000..9ec6458
--- /dev/null
@@ -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 (file)
index 0000000..dc132f8
--- /dev/null
@@ -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 (file)
index 0000000..8af15ab
--- /dev/null
@@ -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 (file)
index 0000000..05afabf
--- /dev/null
@@ -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