]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: mingw: emit seh_endproc as comment
authorSaurabh Jha <saurabh.jha@arm.com>
Thu, 9 Oct 2025 14:04:45 +0000 (14:04 +0000)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 2 Dec 2025 01:19:48 +0000 (17:19 -0800)
For mingw targets, there is no way to identify the end of function using
assembly directives right now.

This patch adds such directive as a comment. This is not a real
directive because some other things, like Structured Exception Handling
(SEH), needs to be supported before we can emit a real directive.

However, emitting an end of function marker now will let us modify
check-function-bodies in scanasm.exp, which in turn enables us to write
dg-compile tests for mingw target.

gcc/ChangeLog:

* config/aarch64/aarch64-abi-ms.h
(ASM_COMMENT_START): Specify start of comment.
(ASM_OUTPUT_TYPE_DIRECTIVE): Moved from aarch64-coff.h.
(ASM_DECLARE_FUNCTION_SIZE): Specify end of function as comment.
* config/aarch64/aarch64-coff.h
(ASM_OUTPUT_TYPE_DIRECTIVE): Moved to aarch64-abi-ms.h.
(ASM_DECLARE_FUNCTION_SIZE): Moved to aarch64-abi-ms.h.

gcc/testsuite/ChangeLog:

* lib/scanasm.exp: Add support for mingw targets.

gcc/config/aarch64/aarch64-abi-ms.h
gcc/config/aarch64/aarch64-coff.h
gcc/testsuite/lib/scanasm.exp

index bc9ada01772a481b9e702a7875255c0215a27fa5..6eefe2188b62e44dda30213b447c608f1019a0d0 100644 (file)
@@ -31,4 +31,16 @@ along with GCC; see the file COPYING3.  If not see
 #undef  STATIC_CHAIN_REGNUM
 #define STATIC_CHAIN_REGNUM R17_REGNUM
 
+#define ASM_COMMENT_START "//"
+
+/* ASM_OUTPUT_TYPE_DIRECTIVE is not yet supported by binutils for the
+   aarch64-w64-mingw32 target.  */
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)
+
+/* Structured Exception Handling (SEH) is not yet supported by binutils
+   so adding seh_endproc as an assembly comment to mark the end of a
+   function.  */
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
+  fprintf (FILE, "\t" ASM_COMMENT_START "  seh_endproc\n")
+
 #endif /* GCC_AARCH64_ABI_MS_H.  */
index 72607262e1ba830968bad3286f086185cceadec7..42ae022720ceefdf5a6af09042dd3470afae27e6 100644 (file)
 #define ASM_OUTPUT_SKIP(STREAM, NBYTES)        \
   fprintf (STREAM, "\t.space\t%d  // skip\n", (int) (NBYTES))
 
-/* Definitions that are not yet supported by binutils for the
-   aarch64-w64-mingw32 target.  */
-#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)
-
 #define TEXT_SECTION_ASM_OP    "\t.text"
 #define DATA_SECTION_ASM_OP    "\t.data"
 #define BSS_SECTION_ASM_OP     "\t.bss"
index 51952a6a7f45f6b264c8b450a7abc6007a15705c..75303912f2375dd8d71edd8bae6946fe460c9f21 100644 (file)
@@ -885,6 +885,8 @@ proc configure_check-function-bodies { config } {
        set up_config(end) {^\}$}
     } elseif { [istarget *-*-darwin*] } {
        set up_config(end) {^LFE[0-9]+}
+    } elseif { [istarget aarch64*-*-mingw32] } {
+       set up_config(end) {seh_endproc}
     } else {
        set up_config(end) {^\s*\.size}
     }