Re: [PATCH v3 1/1] aarch64: Add SEH, stack unwinding and C++ exceptions.

Evgeny Karpov <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
On Wed, 29 Jul 2026, Saurabh Jha wrote:
> Mostly style comments; was also able to build a cross compiler with host and
> build aarch64-linux-gnu and target aarch64-w64-mingw32 using your bintuils
> SEH patch [v12,1/1] aarch64: Implement Structured Exception Handling (SEH)
> on AArch64 - Patchwork <https://patchwork.sourceware.org/project/binutils/patch/[email protected]/>
> 
> Would it be possible for you to add a `dg-run` test that could exercise the
> exception throw and catch facilities?

There should be enough tests for C++ exceptions.
This testing can be simplified by building the native compiler.
For cross-compilation, it is more challenging as tests should be transferred and
executed in the native environment.
 
> > +  if (opts->x_flag_unwind_tables)
> > +    return UI_SEH;
> > +
> > +  if (DWARF2_UNWIND_INFO)
> > +    return UI_DWARF2;
> > +
> > +  return UI_SJLJ;
> Nit: Would it be useful to add comments over the if branch of
> DWARF2_UNWIND_INFO and the default UI_SJLJ like you did for others? That
> would also help readers understand why is UI_SJLJ default, for example.

A comment will be added.

> > +    gcc_unreachable ();
> > +
> > +  const HOST_WIDE_INT reg_offset = INTVAL (XEXP (src, 1));
> > +  src = XEXP (src, 0);
> > +
> > +  gcc_assert (src == stack_pointer_rtx);
> > +  gcc_assert (seh->cfa_reg == stack_pointer_rtx);
> Should we fold these two asserts into a single assert separated by &&? If
> you agree to this, might be useful to flip the order of both equality
> asserts so that stack_pointer_rtx comes first. That would then read
> "stack_pointer_rtx equals this and stack_pointer_rtx equals that".

Two separate asserts might be useful to validate two different conditions and
see the precise location of an unexpected value.

> > +	     unwind_code_infix,
> > +	     unwind_code_suffix,
> > +	     offset);
> > +    return;
> > +  }
> > +
> > +  const unsigned save_r19r20_x_max_offset = 248;
> 
> Can you add a comment about this max_offset please?

An explanation will be added.

Regards,
Evgeny
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.