[v7,0/3] Implement Structured Exception Handling (SEH) on AArch64

Message ID 20260319111638.93074-1-evgeny.karpov@arm.com
Headers
Series Implement Structured Exception Handling (SEH) on AArch64 |

Message

Evgeny Karpov March 19, 2026, 11:16 a.m. UTC
  Hello,

Thank you for reviewing v6!
v7 contains the minor changes.

Changes in v7:
- Rename sort_x64_pdata to sort_pdata.
- Move obj_coff_seh_do_final implementation to a separate function.
- Merge patch 3/4 with 4/4.

Changes in v6 2026-03-11:
- 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.
https://sourceware.org/pipermail/binutils/2026-March/148488.html

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 (3):
  Adjust pdata function table entries sorting for AArch64
  Extract SEH shared helpers into separate file.
  aarch64: Implement Structured Exception Handling (SEH) on AArch64

 bfd/peXXigen.c                    |  18 +-
 gas/config/obj-coff-seh-aarch64.c | 889 ++++++++++++++++++++++++++++++
 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           |  10 +
 gas/config/tc-aarch64.h           |   6 +
 gas/write.c                       |   2 +-
 gas/write.h                       |   1 +
 11 files changed, 1416 insertions(+), 197 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