aarch64: Implement Structured Exception Handling (SEH)
aarch64: binutils now supports emitting SEH .pdata/.xdata records for exception handling on AArch64.
binutils now supports emitting Structured Exception Handling (SEH) information for the AArch64 architecture. This implementation, based on Microsoft’s ARM64 exception handling model, generates .pdata and .xdata records. The process required modifications to the object file generation, including relaxing the code segment to accurately calculate function sizes and emitting these SEH records later in the assembly process via a new md_finish hook.
In Details
This commit adds SEH support for AArch64 to binutils, generating .pdata/.xdata records based on the MSFT model. It introduces seh_aarch64_write_data called from md_finish in tc-aarch64.c. A key challenge addressed is the late calculation of function sizes, necessitating relaxation of the code segment. The previous location of obj_coff_generate_pdata in write_object_file was found to be too early for this purpose.
- SEH
- Structured Exception Handling. A mechanism for handling errors and exceptional control flow in a program, particularly common on Windows platforms.
- AArch64
- The 64-bit ARM architecture, commonly used in mobile devices, servers, and embedded systems.
- .pdata
- A section in Windows Portable Executable (PE) files that contains runtime function information, used for exception handling and stack unwinding.
- .xdata
- A section in Windows Portable Executable (PE) files that contains exception handling information, such as callback information and language-specific data.
- gas
- The GNU Assembler, which translates assembly language code into machine code.
- md_finish
- A hook or function within the assembler's object file generation process, called after all assembly has been processed but before the final object file is written. Used here for emitting SEH data.
- PE file
- Portable Executable file format, the standard file format for executables, DLLs, object code, and system drivers on Windows operating systems.