aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-coff-seh.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-05-28 13:40:50 +0930
committerAlan Modra <amodra@gmail.com>2024-05-29 10:28:22 +0930
commit7574c0c2b386efa4bd0b1735237403177e4a964e (patch)
tree8c0bc1cb3c11601f53bdaadb708156955673cf21 /gas/config/obj-coff-seh.c
parent5a44fd84de52ceeaf5f67c37143f68fcd8bc5f1d (diff)
downloadgdb-7574c0c2b386efa4bd0b1735237403177e4a964e.zip
gdb-7574c0c2b386efa4bd0b1735237403177e4a964e.tar.gz
gdb-7574c0c2b386efa4bd0b1735237403177e4a964e.tar.bz2
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.
Diffstat (limited to 'gas/config/obj-coff-seh.c')
-rw-r--r--gas/config/obj-coff-seh.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c
index 24cc720..13c4439 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 ();