[PATCH v6 0/4] Implement Structured Exception Handling (SEH) on AArch64

Evgeny Karpov evgeny.karpov@arm.com
Wed Mar 11 14:11:42 GMT 2026


Hello,

Thank you for reviewing v5!
v6 resolves the issue with the calculation of the function size without changes
in frag_offset_ignore_align_p.

Changes in v6:
- Revert changes in frag_offset_ignore_align_p.
- Relax the code segment to be able to calculate the function sizes.
- Add seh_function_size that implements the calculation of the function size
  and replace frag_offset_ignore_align_p call with this implementation. 

Changes in v5 2026-02-24:
- In many places int, uint32_t and int32_t have been replaced to unsigned.
- Refactor and move SEH aarch64 implementation to separate files.
- Replace uintptr_t with bfd_vma.
- Update comments.
- Add dedicated initializers.
- Move some variables inside loops.
- Fix the definition for packing some unwinding codes.
- Add description to seh commands.
- Rename prolog_instruction_count to prolog_insn_count.
- Relocate variable initilization closer to place of use.
- Add unwind_ prefix to unwind type enumerator.
https://sourceware.org/pipermail/binutils/2026-February/148332.html

Changes in v3(v4) 2025-08-14:
- Make the AArch64 implementation fully static.
- Fix ARM64_MAX_UNWIND_CODES and introduce AARCH64_MAX_UNWIND_CODES_SIZE.
- Add validation for the epilogue_scope array.
- Add an upper bound for the register number.
- Exclude changes in md_do_align.
- Refactor the AArch64 SEH implementation to emit .pdata/.xdata records at
  the end of assembly.
- Declare md_finish for AArch64 to trigger obj_coff_generate_pdata.
- Support different fragment ordering in frag_offset_ignore_align_p
- Change signed to unsigned.
- Replace Arm64 / arm64 with AArch64 / aarch64.
- Add references to the official documentation to clarify
  implementation.
- Add static and aarch64_ prefix.
- Rebase onto the current master.
- Fix comments.
- Correct code style and naming.
https://sourceware.org/pipermail/binutils/2025-August/143401.html

Changes in v2 2025-05-09:
- Add guards for different architectures
- Fix code style issues and typos
- Move Arm64-specific code to pdata/xdata functions
- Prefer unsigned int over uint32_t in some places
- Revert memory release to the original implementation
- Refactor long function fragmentation
- Fix the function size calculation issue related to code alignment
https://sourceware.org/pipermail/binutils/2025-May/140961.html

v1 2025-04-09:
This patch series supports the GCC patch series that implements SEH
support for the aarch64-w64-mingw32 target.
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/669003.html
The patch series has been tested by applying internal tests and passing
all Boost library tests that involve exception handling.
https://sourceware.org/pipermail/binutils/2025-April/140495.html

Regards,
Evgeny

Evgeny Karpov (4):
  Adjust pdata function table entries sorting for AArch64
  Extract SEH shared helpers into separate file.
  aarch64: Implement Structured Exception Handling (SEH) on AArch64
  aarch64: Emit pdata/xdata SEH records from md_finish

 bfd/peXXigen.c                    |  16 +-
 gas/config/obj-coff-seh-aarch64.c | 884 ++++++++++++++++++++++++++++++
 gas/config/obj-coff-seh-aarch64.h | 265 +++++++++
 gas/config/obj-coff-seh-shared.c  | 219 ++++++++
 gas/config/obj-coff-seh.c         | 193 -------
 gas/config/obj-coff-seh.h         |   5 +
 gas/config/obj-coff.c             |   5 +
 gas/config/tc-aarch64.c           |  12 +
 gas/config/tc-aarch64.h           |   5 +
 gas/write.c                       |   2 +-
 gas/write.h                       |   1 +
 11 files changed, 1411 insertions(+), 196 deletions(-)
 create mode 100644 gas/config/obj-coff-seh-aarch64.c
 create mode 100644 gas/config/obj-coff-seh-aarch64.h
 create mode 100644 gas/config/obj-coff-seh-shared.c



More information about the Binutils mailing list