Re: [PATCH v13 1/1] aarch64: Implement Structured Exception Handling (SEH) on AArch64

Alice Carlotti <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On Fri, Aug 07, 2026 at 04:37:11PM +0200, Evgeny Karpov wrote:
> The patch reuses shared helpers for SEH and implements SEH on AArch64.
> The implementation is based on
> (https://learn.microsoft.com/en-us/cpp/build/arm64-exception-handling?view=msvc-170)
> and pdata/xdata SEH records are emitted from md_finish.
> 
> When .pdata/.xdata is emitted, the function size is required.
> Function sizes are calculated as late as possible, and the code segment needs
> to be relaxed to be able to calculate the function sizes.
> 
> Initially, obj_coff_generate_pdata was called in write_object_file.
> Before the change, obj_coff_generate_pdata was used only to validate
> syntax, which was sufficient for that purpose. However, that location
> seems incorrect, as it is too late to emit .pdata/.xdata records
> in the AArch64 case.
> 
> md_finish has been declared for AArch64 and extended with
> seh_aarch64_write_data to emit .pdata/.xdata records after all
> assembly has been completed.
> 
> Signed-off-by: Evgeny Karpov <[email protected]>
> 
> gas/ChangeLog:
> 	* gas/config/obj-coff-seh-shared.c (defined): Update.
> 	(struct seh_seg_list): Use seh_context_t.
> 	* gas/config/obj-coff.c (defined): Update.
> 	* gas/config/tc-aarch64.c (defined): Add OBJ_COFF guard.
> 	(aarch64_md_finish): Add.
> 	* gas/config/tc-aarch64.h (defined): Add OBJ_COFF guard.
> 	(md_finish): Add.
> 	(aarch64_md_finish): Add.
> 	(seh_aarch64_write_data): Add.
> 	* testsuite/gas/pe/pe.exp: Add SEH tests.
> 	* write.c: Update.
> 	* write.h (subsegs_finish_section): Update.
> 	* config/obj-coff-seh-aarch64.c: New file.
> 	* config/obj-coff-seh-aarch64.h: New file.
> 	* testsuite/gas/pe/seh-aarch64-error.l: New test.
> 	* testsuite/gas/pe/seh-aarch64-error.s: New test.
> 	* testsuite/gas/pe/seh-aarch64-large-func.d: New test.
> 	* testsuite/gas/pe/seh-aarch64-large-func.s: New test.
> 	* testsuite/gas/pe/seh-aarch64.d: New test.
> 	* testsuite/gas/pe/seh-aarch64.s: New test.


Ok, thanks -  I've pushed this version.

Alice
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.