public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Radek Barton <radek.barton@microsoft.com>
Cc: Richard Sandiford <richard.sandiford@arm.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	"pinskia@gmail.com" <pinskia@gmail.com>,
	"10walls@gmail.com" <10walls@gmail.com>
Subject: Re: [RFC] Either fix or disable SME feature for `aarch64-w64-mingw32` target?
Date: Thu, 25 Jan 2024 17:46:51 +0000	[thread overview]
Message-ID: <ZbKei3TTsUCu/0c2@arm.com> (raw)
In-Reply-To: <PR3PR83MB0459F913A5B9DC16D1AFC166926C2@PR3PR83MB0459.EURPRD83.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 42 bytes --]

The 01/15/2024 17:21, Radek Barton wrote:

[-- Attachment #2: v4-0001-Ifdef-.hidden-.type-and-.size-pseudo-ops-for-aarc.patch --]
[-- Type: application/octet-stream, Size: 6375 bytes --]

From 1a896c6b43a57b29fa0bc4d32aa86d7e28b824da Mon Sep 17 00:00:00 2001
In-Reply-To: <mptsf34rpad.fsf@arm.com>
References: <mptsf34rpad.fsf@arm.com>
From: Zac Walker <zacwalker@microsoft.com>
Date: Wed, 3 Jan 2024 20:21:04 +0100
Subject: [PATCH v4] Ifdef `.hidden`, `.type`, and `.size` pseudo-ops for
 `aarch64-w64-mingw32` target
Cc: Andrew Pinski <pinskia@gmail.com>,
    Richard Sandiford <richard.sandiford@arm.com>,
    Jonathan Yong <10walls@gmail.com>,
    Richard Sandiford <richard.sandiford@arm.com>

Recent change (https://gcc.gnu.org/pipermail/gcc-cvs/2023-December/394915.html) added a generic SME support using `.hidden`, `.type`, and ``.size` pseudo-ops in the assembly sources, `aarch64-w64-mingw32` does not support the pseudo-ops though. This patch wraps usage of those pseudo-ops using macros and ifdefs them for `__ELF__` define.
---
 libgcc/config/aarch64/__arm_sme_state.S   |  2 +-
 libgcc/config/aarch64/__arm_tpidr2_save.S |  4 ++--
 libgcc/config/aarch64/__arm_za_disable.S  |  6 +++---
 libgcc/config/aarch64/aarch64-asm.h       | 14 ++++++++++++--
 libgcc/config/aarch64/crti.S              | 12 ++++--------
 libgcc/config/aarch64/lse.S               |  9 +++++----
 6 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/libgcc/config/aarch64/__arm_sme_state.S b/libgcc/config/aarch64/__arm_sme_state.S
index 0da9b585b6c..1fbb8c1ff53 100644
--- a/libgcc/config/aarch64/__arm_sme_state.S
+++ b/libgcc/config/aarch64/__arm_sme_state.S
@@ -30,7 +30,7 @@
    - Takes no argument.
    - Returns SME state in x0 and TPIDR2_EL0 in x1.  */
 
-.hidden __aarch64_have_sme
+HIDDEN (__aarch64_have_sme)
 
 variant_pcs (__arm_sme_state)
 
diff --git a/libgcc/config/aarch64/__arm_tpidr2_save.S b/libgcc/config/aarch64/__arm_tpidr2_save.S
index 9135cba1ddb..2466b5863e4 100644
--- a/libgcc/config/aarch64/__arm_tpidr2_save.S
+++ b/libgcc/config/aarch64/__arm_tpidr2_save.S
@@ -31,7 +31,7 @@
    - Does not return a value.
    - Can abort on failure (then registers are not preserved).  */
 
-.hidden __aarch64_have_sme
+HIDDEN (__aarch64_have_sme)
 
 variant_pcs (__arm_tpidr2_save)
 
@@ -97,5 +97,5 @@ END (__arm_tpidr2_save)
 
 /* Hidden alias used by __arm_za_disable.  */
 .global __libgcc_arm_tpidr2_save
-.hidden __libgcc_arm_tpidr2_save
+HIDDEN (__libgcc_arm_tpidr2_save)
 .set __libgcc_arm_tpidr2_save, __arm_tpidr2_save
diff --git a/libgcc/config/aarch64/__arm_za_disable.S b/libgcc/config/aarch64/__arm_za_disable.S
index 5785a959e22..c372fcffe18 100644
--- a/libgcc/config/aarch64/__arm_za_disable.S
+++ b/libgcc/config/aarch64/__arm_za_disable.S
@@ -31,9 +31,9 @@
    - Does not return a value.
    - Can abort on failure (then registers are not preserved).  */
 
-.hidden __aarch64_have_sme
+HIDDEN (__aarch64_have_sme)
 
-.hidden __libgcc_arm_tpidr2_save
+HIDDEN (__libgcc_arm_tpidr2_save)
 
 variant_pcs (__arm_za_disable)
 
@@ -66,5 +66,5 @@ END (__arm_za_disable)
 
 /* Hidden alias used by the unwinder.  */
 .global __libgcc_arm_za_disable
-.hidden __libgcc_arm_za_disable
+HIDDEN (__libgcc_arm_za_disable)
 .set __libgcc_arm_za_disable, __arm_za_disable
diff --git a/libgcc/config/aarch64/aarch64-asm.h b/libgcc/config/aarch64/aarch64-asm.h
index 24568429b5c..83c2e5944b3 100644
--- a/libgcc/config/aarch64/aarch64-asm.h
+++ b/libgcc/config/aarch64/aarch64-asm.h
@@ -58,6 +58,16 @@
 # define AUTIASP
 #endif
 
+#ifdef __ELF__
+#define HIDDEN(name) .hidden name
+#define SYMBOL_SIZE(name) .size name, .-name
+#define SYMBOL_TYPE(name, _type) .type name, _type
+#else
+#define HIDDEN(name)
+#define SYMBOL_SIZE(name)
+#define SYMBOL_TYPE(name, _type)
+#endif
+
 /* Add a NT_GNU_PROPERTY_TYPE_0 note.  */
 #define GNU_PROPERTY(type, value)	\
   .section .note.gnu.property, "a";	\
@@ -85,7 +95,7 @@ GNU_PROPERTY (FEATURE_1_AND, BTI_FLAG|PAC_FLAG)
 
 #define ENTRY_ALIGN(name, align) \
   .global name;		\
-  .type name,%function;	\
+  SYMBOL_TYPE(name, %function);		\
   .balign align;	\
   name:			\
   .cfi_startproc;	\
@@ -95,4 +105,4 @@ GNU_PROPERTY (FEATURE_1_AND, BTI_FLAG|PAC_FLAG)
 
 #define END(name) \
   .cfi_endproc;		\
-  .size name, .-name
+  SYMBOL_SIZE(name)
diff --git a/libgcc/config/aarch64/crti.S b/libgcc/config/aarch64/crti.S
index 1371967c196..b6805b86421 100644
--- a/libgcc/config/aarch64/crti.S
+++ b/libgcc/config/aarch64/crti.S
@@ -21,6 +21,8 @@
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # <http://www.gnu.org/licenses/>.
 
+#include "aarch64-asm.h"
+
 /* An executable stack is *not* required for these functions.  */
 #if defined(__ELF__) && defined(__linux__)
 .section .note.GNU-stack,"",%progbits
@@ -31,12 +33,6 @@
 # .init sections.  Users may put any desired instructions in those
 # sections.
 
-#ifdef __ELF__
-#define TYPE(x) .type x,function
-#else
-#define TYPE(x)
-#endif
-
 	# Note - this macro is complemented by the FUNC_END macro
 	# in crtn.S.  If you change this macro you must also change
 	# that macro match.
@@ -53,7 +49,7 @@
 	.section	".init"
 	.align 2
 	.global	_init
-	TYPE(_init)
+	SYMBOL_TYPE(_init, function)
 _init:
 	FUNC_START
 
@@ -61,7 +57,7 @@ _init:
 	.section	".fini"
 	.align	2
 	.global	_fini
-	TYPE(_fini)
+	SYMBOL_TYPE(_fini, function)
 _fini:
 	FUNC_START
 
diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S
index 671a86cfb87..cee1e88c6a4 100644
--- a/libgcc/config/aarch64/lse.S
+++ b/libgcc/config/aarch64/lse.S
@@ -51,6 +51,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
  * indirectly, they do not need to start with a BTI instruction.
  */
 
+#include "aarch64-asm.h"
 #include "auto-target.h"
 
 /* Tell the assembler to accept LSE instructions.  */
@@ -61,7 +62,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #endif
 
 /* Declare the symbol gating the LSE implementations.  */
-	.hidden	__aarch64_have_lse_atomics
+	HIDDEN(__aarch64_have_lse_atomics)
 
 /* Turn size and memory model defines into mnemonic fragments.  */
 #if SIZE == 1
@@ -171,15 +172,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 	.text
 	.balign	16
 	.globl	\name
-	.hidden	\name
-	.type	\name, %function
+	HIDDEN(\name)
+	SYMBOL_TYPE(\name, %function)
 	.cfi_startproc
 \name:
 .endm
 
 .macro	ENDFN name
 	.cfi_endproc
-	.size	\name, . - \name
+	SYMBOL_SIZE(\name)
 .endm
 
 /* Branch to LABEL if LSE is disabled.  */
-- 
2.43.0.windows.1


  parent reply	other threads:[~2024-01-25 17:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <PR3PR83MB0459E41CA2C7CF4A233A2DA492672@PR3PR83MB0459.EURPRD83.prod.outlook.com>
     [not found] ` <PR3PR83MB0459CD0B388EC092D67DCF9E92672@PR3PR83MB0459.EURPRD83.prod.outlook.com>
2024-01-04 13:50   ` Fw: " Radek Barton
2024-01-04 19:11     ` Andrew Pinski
2024-01-05 14:43       ` [EXTERNAL] " Radek Barton
2024-01-09 19:37     ` Radek Barton
2024-01-10  8:49       ` Jonathan Yong
2024-01-10  9:02         ` Iain Sandoe
2024-01-10  9:13           ` Iain Sandoe
2024-01-10 10:32             ` [EXTERNAL] " Radek Barton
2024-01-11 13:08       ` Richard Sandiford
2024-01-15 16:07         ` Radek Barton
2024-01-15 17:21           ` Radek Barton
2024-01-18 12:06             ` Radek Barton
2024-01-25 17:46             ` Szabolcs Nagy [this message]
2024-01-25 17:51             ` Szabolcs Nagy
2024-01-23 15:35           ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZbKei3TTsUCu/0c2@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=10walls@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=radek.barton@microsoft.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).