On Thu, Jun 25, 2026 at 07:41:49PM +0200, Evgeny Karpov wrote: > This patch reuses the existing SEH, stack unwinding and C++ exceptions > from ix86 and implements the required unwinding for AArch64. > > Co-authored-by: Zac Walker <[email protected]> > Signed-off-by: Evgeny Karpov <[email protected]> ...
> diff --git a/libstdc++-v3/libsupc++/eh_personality.cc > b/libstdc++-v3/libsupc++/eh_personality.cc > index 10458318f88..acf93edf648 100644 > --- a/libstdc++-v3/libsupc++/eh_personality.cc > +++ b/libstdc++-v3/libsupc++/eh_personality.cc > @@ -23,6 +23,7 @@ > // <http://www.gnu.org/licenses/>. > > #include <bits/c++config.h> > +#include <cstdint> > #include <cstdlib> > #include <bits/exception_defines.h> > #include <cxxabi.h> > @@ -54,6 +55,20 @@ parse_lsda_header (_Unwind_Context *context, const > unsigned char *p, > > info->Start = (context ? _Unwind_GetRegionStart (context) : 0); > > +#if defined (__SEH__) && defined (__aarch64__) > + /* Large functions on AArch64 (>= 1MB) are split into multiple fragments. > + However, it is expected the most of the functions will have only one > + fragment. The beginning of each SEH handler data in .xdata record > starts > + with a fragment offset and an address to .seh_handlerdata. > + .seh_handlerdata is emitted only once for the .xdata record of the last > + fragment. */ I found this comment very hard to understand. Having investigated further, I think the following is an accurate description of what is going on here: /* On AArch64, a single function may be split into multiple function fragments, each with it's own .pdata and (if required) .xdata records. The language-specific exception handler data in .xdata records used by GCC consists of two values: - The offset of the fragment within the full function; - The RVA of a .seh_handlerdata record, which is shared by all fragments of the function. */ Is this correct, and does it seem clearer to you than your original comment? Thanks, Alice > + uint32_t fragment_offset = *(uint32_t *) p; > + p += sizeof (uint32_t); > + info->Start -= fragment_offset; > + uint32_t handler_data_rva = *(uint32_t *) p; > + p = (unsigned char *) _Unwind_GetTextRelBase (context) + handler_data_rva; > +#endif > + > // Find @LPStart, the base to which landing pad offsets are relative. > lpstart_encoding = *p++; > if (lpstart_encoding != DW_EH_PE_omit)
