[binutils-gdb] PR31796, Internal error in write_function_pdata at obj-coff-seh

Alan Modra amodra@sourceware.org
Wed May 29 00:58:43 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7574c0c2b386efa4bd0b1735237403177e4a964e

commit 7574c0c2b386efa4bd0b1735237403177e4a964e
Author: Alan Modra <amodra@gmail.com>
Date:   Tue May 28 13:40:50 2024 +0930

    PR31796, Internal error in write_function_pdata at obj-coff-seh
    
    PR31796 is the result of lack of aarch64 support in obj-coff-seh.c.
    Nick fixed this with commit 73c8603c3f.  Make the seh support
    consistently warn in future if some archictecture is missing, rather
    than giving internal errors.
    
            PR 31796
            * config/obj-coff-seh.c (verify_target): New function.
            (obj_coff_seh_handler, obj_coff_seh_endproc, obj_coff_seh_proc),
            (obj_coff_seh_endprologue): Use it.

Diff:
---
 gas/config/obj-coff-seh.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c
index 24cc7209be6..13c4439db93 100644
--- a/gas/config/obj-coff-seh.c
+++ b/gas/config/obj-coff-seh.c
@@ -228,6 +228,20 @@ seh_get_target_kind (void)
   return seh_kind_unknown;
 }
 
+/* Verify that seh directives are supported.  */
+
+static bool
+verify_target (const char *directive)
+{
+  if (seh_get_target_kind () == seh_kind_unknown)
+    {
+      as_warn (_("%s ignored for this target"), directive);
+      ignore_rest_of_line ();
+      return false;
+    }
+  return true;
+}
+
 /* Verify that we're in the context of a seh_proc.  */
 
 static int
@@ -315,7 +329,8 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED)
   char *symbol_name;
   char name_end;
 
-  if (!verify_context (".seh_handler"))
+  if (!verify_target (".seh_handler")
+      || !verify_context (".seh_handler"))
     return;
 
   if (*input_line_pointer == 0 || *input_line_pointer == '\n')
@@ -408,6 +423,8 @@ do_seh_endproc (void)
 static void
 obj_coff_seh_endproc (int what ATTRIBUTE_UNUSED)
 {
+  if (!verify_target (".seh_endproc"))
+    return;
   demand_empty_rest_of_line ();
   if (seh_ctx_cur == NULL)
     {
@@ -426,6 +443,8 @@ obj_coff_seh_proc (int what ATTRIBUTE_UNUSED)
   char *symbol_name;
   char name_end;
 
+  if (!verify_target (".seh_proc"))
+    return;
   if (seh_ctx_cur != NULL)
     {
       as_bad (_("previous SEH entry not closed (missing .seh_endproc)"));
@@ -466,7 +485,8 @@ obj_coff_seh_proc (int what ATTRIBUTE_UNUSED)
 static void
 obj_coff_seh_endprologue (int what ATTRIBUTE_UNUSED)
 {
-  if (!verify_context (".seh_endprologue")
+  if (!verify_target (".seh_endprologue")
+      || !verify_context (".seh_endprologue")
       || !seh_validate_seg (".seh_endprologue"))
     return;
   demand_empty_rest_of_line ();


More information about the Binutils-cvs mailing list