diff --git a/libgcc/config/aarch64/__arm_sme_state.S b/libgcc/config/aarch64/__arm_sme_state.S
index 0da9b585b6ca1721d631c7699a1e01f0b1451184..1fbb8c1ff535665dc065eac9248964d41eabb51e 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 9135cba1ddb099eac33e16f89c87126a4f11bfda..2466b5863e4ef0f9bbc6a8d9483854389e80e21b 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 5785a959e22344ea97431aa96af367b6d31fb1e7..c372fcffe1825b64fb0ad2a5362b16b8ebb29551 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 24568429b5ce7a455ea66582bd5b09067f2f9601..83c2e5944b37e1a099e0de46705afda599f5f36a 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 1371967c196fb8e32706cfc62ba9d4722a30d2fc..b6805b864218c71886fbdf00e3fda78f2890eaab 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 671a86cfb8748a773e8e7eb320ecd539c068abdc..cee1e88c6a478cbf72cde0550b8cd07933dba112 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.  */