This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch] fix gas crash on missing .seh_endproc
- From: Tristan Gingold <gingold at adacore dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 4 Jul 2017 14:36:57 +0200
- Subject: [Patch] fix gas crash on missing .seh_endproc
- Authentication-results: sourceware.org; auth=none
Hello,
the subject says all: gas were as_abort-ing on a missing seh_endproc.
Also, fix a cut-and-paste typo in the error message.
No regression on x86_64-mingw64.
Ok to commit ?
Tristan.
commit b894c179db0d64e84bfb312b33e03f58d00fcaaa
Author: Tristan Gingold <gingold@adacore.com>
Date: Tue Jul 4 14:27:41 2017 +0200
Fix gas crash on missing seh_endproc.
gas/
* testsuite/gas/pe/seh-x64-err-2.s: New test.
* testsuite/gas/pe/seh-x64-err-2.l: New stderr output.
* testsuite/gas/pe/pe.exp: Add test.
* config/obj-coff-seh.c (obj_coff_seh_do_final): Don't try to end
seh part.
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 4d8abfd..4e8c5fd 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2017-07-04 Tristan Gingold <gingold@adacore.com>
+
+ * testsuite/gas/pe/seh-x64-err-2.s: New test.
+ * testsuite/gas/pe/seh-x64-err-2.l: New stderr output.
+ * testsuite/gas/pe/pe.exp: Add test.
+ * config/obj-coff-seh.c (obj_coff_seh_do_final): Don't try to end
+ seh part.
+
2017-07-03 Alan Modra <amodra@gmail.com>
* testsuite/gas/elf/symver.d: Don't run on hppa64-hpux.
diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c
index 5c028f1..88ce0fc 100644
--- a/gas/config/obj-coff-seh.c
+++ b/gas/config/obj-coff-seh.c
@@ -483,10 +483,7 @@ void
obj_coff_seh_do_final (void)
{
if (seh_ctx_cur != NULL)
- {
- as_bad (_("open SEH entry at end of file (missing .cfi_endproc)"));
- do_seh_endproc ();
- }
+ as_bad (_("open SEH entry at end of file (missing .seh_endproc)"));
}
/* Enter a prologue element into current context (x64). */
diff --git a/gas/testsuite/gas/pe/pe.exp b/gas/testsuite/gas/pe/pe.exp
index 9293b85..8a6c0d9 100644
--- a/gas/testsuite/gas/pe/pe.exp
+++ b/gas/testsuite/gas/pe/pe.exp
@@ -43,6 +43,7 @@ run_dump_test "set"
# These tests are only for x86_64 targets
if ([istarget "x86_64-*-mingw*"]) then {
run_list_test "seh-x64-err-1" ""
+ run_list_test "seh-x64-err-2" ""
run_dump_test "peseh-x64"
run_dump_test "peseh-x64-2"
run_dump_test "peseh-x64-3"
diff --git a/gas/testsuite/gas/pe/seh-x64-err-1.s
b/gas/testsuite/gas/pe/seh-x64-err-1.s
index c472257..390bb4b 100644
--- a/gas/testsuite/gas/pe/seh-x64-err-1.s
+++ b/gas/testsuite/gas/pe/seh-x64-err-1.s
@@ -38,3 +38,10 @@ test_wrong_segment:
.seh_savexmm %xmm1
.seh_endproc
+# missing endproc
+ .text
+ .seh_proc test_missing_endproc
+test_missing_endproc:
+ .seh_setframe %rbp, 0
+ .seh_endprologue
+ ret
diff --git a/gas/testsuite/gas/pe/seh-x64-err-2.l
b/gas/testsuite/gas/pe/seh-x64-err-2.l
new file mode 100644
index 0000000..48019ec
--- /dev/null
+++ b/gas/testsuite/gas/pe/seh-x64-err-2.l
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+
+.*: Error: open SEH entry at end of file \(missing .seh_endproc\)
diff --git a/gas/testsuite/gas/pe/seh-x64-err-2.s
b/gas/testsuite/gas/pe/seh-x64-err-2.s
new file mode 100644
index 0000000..2feff04
--- /dev/null
+++ b/gas/testsuite/gas/pe/seh-x64-err-2.s
@@ -0,0 +1,9 @@
+ .file "t2.c"
+ .text
+
+# missing endproc
+ .seh_proc test_missing_endproc
+test_missing_endproc:
+ .seh_setframe %rbp, 0
+ .seh_endprologue
+ ret