You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2025/11/13 17:49:17 UTC

(nuttx) 01/05: toolchain/ghs: add Greenhills compiler support for .type directive for arm-v8r

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1d9e160f97023cde87dbf624cd569239a91e1c8f
Author: xiezhanpeng3 <xi...@lixiang.com>
AuthorDate: Wed Nov 12 15:52:03 2025 +0800

    toolchain/ghs: add Greenhills compiler support for .type directive for arm-v8r
    
    The GreenHills Compiler uses different grammer for the .type directive
    in asm, this patch adds support for the grammer for arm-v8r.
    Similar change for arm-v7r was done in pull request #12883.
    
    Co-authored-by: Chengdong Wang <wa...@lixiang.com>
    Signed-off-by: xiezhanpeng3 <xi...@lixiang.com>
---
 arch/arm/src/armv8-r/arm_fpuconfig.S       |  4 +++
 arch/arm/src/armv8-r/arm_head.S            | 32 +++++++++++++++++++++
 arch/arm/src/armv8-r/arm_saveusercontext.S |  4 +++
 arch/arm/src/armv8-r/arm_vectors.S         | 45 ++++++++++++++++++++++++++++++
 arch/arm/src/common/gnu/arm_fetchadd.S     | 24 ++++++++++++++++
 5 files changed, 109 insertions(+)

diff --git a/arch/arm/src/armv8-r/arm_fpuconfig.S b/arch/arm/src/armv8-r/arm_fpuconfig.S
index c4a7c342908..2986655fd67 100644
--- a/arch/arm/src/armv8-r/arm_fpuconfig.S
+++ b/arch/arm/src/armv8-r/arm_fpuconfig.S
@@ -66,7 +66,11 @@
  ****************************************************************************/
 
 	.globl	arm_fpuconfig
+#ifdef __ghs__
+	.type	arm_fpuconfig, $function
+#else
 	.type	arm_fpuconfig, %function
+#endif
 
 arm_fpuconfig:
 
diff --git a/arch/arm/src/armv8-r/arm_head.S b/arch/arm/src/armv8-r/arm_head.S
index 6d3eec5ff4e..36a5e0a7fba 100644
--- a/arch/arm/src/armv8-r/arm_head.S
+++ b/arch/arm/src/armv8-r/arm_head.S
@@ -132,7 +132,11 @@
 	.syntax	unified
 	.arm
 	.global	__start
+#ifdef __ghs__
+	.type	__start, $function
+#else
 	.type	__start, #function
+#endif
 
 __start:
 	/* Get cpuindex, cpu0 continue boot, others wait event from cpu0 */
@@ -275,7 +279,11 @@ __cpu0_start:
  ***************************************************************************/
 
 	.global	arm_data_initialize
+#ifdef __ghs__
+	.type	arm_data_initialize, $function
+#else
 	.type	arm_data_initialize, #function
+#endif
 
 arm_data_initialize:
 
@@ -354,7 +362,11 @@ arm_data_initialize:
  ***************************************************************************/
 
 	.global	hsctlr_initialize
+#ifdef __ghs__
+	.type	hsctlr_initialize, $function
+#else
 	.type	hsctlr_initialize, #function
+#endif
 
 hsctlr_initialize:
 	mrc		CP15_HSCTLR(r0)		/* Get Hyp System Control Register */
@@ -386,7 +398,11 @@ hsctlr_initialize:
  ***************************************************************************/
 
 	.global	sctlr_initialize
+#ifdef __ghs__
+	.type	sctlr_initialize, $function
+#else
 	.type	sctlr_initialize, #function
+#endif
 
 sctlr_initialize:
 	/* Configure the system control register (see sctrl.h) */
@@ -553,7 +569,11 @@ sctlr_initialize:
 	 * end of memory.  See g_idle_topstack below.
 	 */
 
+#ifdef __ghs__
+	.type	.Linitparms, $object
+#else
 	.type	.Linitparms, %object
+#endif
 .Linitparms:
 	.long	_sbss
 	.long	_ebss
@@ -564,7 +584,11 @@ sctlr_initialize:
 	.long	_sys_vector_start
 
 #ifdef CONFIG_BOOT_RUNFROMFLASH
+#ifdef __ghs__
+	.type	.Ldatainit, $object
+#else
 	.type	.Ldatainit, %object
+#endif
 .Ldatainit:
 	.long	_eronly					/* Where .data defaults are stored in FLASH */
 	.long	_sdata					/* Where .data needs to reside in SDRAM */
@@ -572,7 +596,11 @@ sctlr_initialize:
 #endif
 
 #ifdef CONFIG_ARCH_RAMFUNCS
+#ifdef __ghs__
+	.type	.Lfuncinit, $object
+#else
 	.type	.Lfuncinit, %object
+#endif
 .Lfuncinit:
 	.long	_framfuncs				/* Where RAM functions are stored in FLASH */
 .Lramfuncs:
@@ -593,7 +621,11 @@ sctlr_initialize:
 	.section	.rodata, "a"
 	.align	4
 	.globl	g_idle_topstack
+#ifdef __ghs__
+	.type	g_idle_topstack, $object
+#else
 	.type	g_idle_topstack, object
+#endif
 
 g_idle_topstack:
 
diff --git a/arch/arm/src/armv8-r/arm_saveusercontext.S b/arch/arm/src/armv8-r/arm_saveusercontext.S
index c67b0c287e2..b95f5858c65 100644
--- a/arch/arm/src/armv8-r/arm_saveusercontext.S
+++ b/arch/arm/src/armv8-r/arm_saveusercontext.S
@@ -54,7 +54,11 @@
 
 	.globl	up_saveusercontext
 	.globl	up_saveusercontext
+#ifdef __ghs__
+	.type	up_saveusercontext, $function
+#else
 	.type	up_saveusercontext, %function
+#endif
 
 up_saveusercontext:
 
diff --git a/arch/arm/src/armv8-r/arm_vectors.S b/arch/arm/src/armv8-r/arm_vectors.S
index 76a601c8c08..f9cf7f94fbe 100644
--- a/arch/arm/src/armv8-r/arm_vectors.S
+++ b/arch/arm/src/armv8-r/arm_vectors.S
@@ -154,7 +154,11 @@
 
 	.globl	arm_decodeirq
 	.globl	arm_vectorirq
+#ifdef __ghs__
+	.type	arm_vectorirq, $function
+#else
 	.type	arm_vectorirq, %function
+#endif
 
 arm_vectorirq:
 
@@ -265,7 +269,11 @@ arm_vectorirq:
 
 	.globl	arm_syscall
 	.globl	arm_vectorsvc
+#ifdef __ghs__
+	.type	arm_vectorsvc, $function
+#else
 	.type	arm_vectorsvc, %function
+#endif
 
 arm_vectorsvc:
 
@@ -375,7 +383,11 @@ arm_vectorsvc:
 
 	.globl	arm_dataabort
 	.globl	arm_vectordata
+#ifdef __ghs__
+	.type	arm_vectordata, $function
+#else
 	.type	arm_vectordata, %function
+#endif
 
 arm_vectordata:
 
@@ -466,7 +478,11 @@ arm_vectordata:
 
 	.globl	arm_prefetchabort
 	.globl	arm_vectorprefetch
+#ifdef __ghs__
+	.type	arm_vectorprefetch, $function
+#else
 	.type	arm_vectorprefetch, %function
+#endif
 
 arm_vectorprefetch:
 
@@ -549,7 +565,11 @@ arm_vectorprefetch:
 
 	.globl	arm_undefinedinsn
 	.globl	arm_vectorundefinsn
+#ifdef __ghs__
+	.type	arm_vectorundefinsn, $function
+#else
 	.type	arm_vectorundefinsn, %function
+#endif
 
 arm_vectorundefinsn:
 
@@ -631,7 +651,11 @@ arm_vectorundefinsn:
 	.globl	arm_decodefiq
 #endif
 	.globl	arm_vectorfiq
+#ifdef __ghs__
+	.type	arm_vectorfiq, $function
+#else
 	.type	arm_vectorfiq, %function
+#endif
 
 arm_vectorfiq:
 #ifdef CONFIG_ARCH_HIPRI_INTERRUPT
@@ -728,7 +752,12 @@ arm_vectorfiq:
  ****************************************************************************/
 
 	.globl	arm_vectoraddrexcptn
+#ifdef __ghs__
+	.type	arm_vectoraddrexcptn, $function
+#else
 	.type	arm_vectoraddrexcptn, %function
+#endif
+
 arm_vectoraddrexcptn:
 	b		arm_vectoraddrexcptn
 	.size	arm_vectoraddrexcptn, . - arm_vectoraddrexcptn
@@ -742,9 +771,17 @@ arm_vectoraddrexcptn:
 	.balign	8
 
 	.globl	g_intstackalloc
+#ifdef __ghs__
+	.type	g_intstackalloc, $object
+#else
 	.type	g_intstackalloc, object
+#endif
 	.globl	g_intstacktop
+#ifdef __ghs__
+	.type	g_intstacktop, $object
+#else
 	.type	g_intstacktop, object
+#endif
 
 g_intstackalloc:
 	.skip	((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
@@ -758,9 +795,17 @@ g_intstacktop:
 
 #ifdef CONFIG_ARCH_HIPRI_INTERRUPT
 	.globl	g_fiqstackalloc
+#ifdef __ghs__
+	.type	g_fiqstackalloc, $object
+#else
 	.type	g_fiqstackalloc, object
+#endif
 	.globl	g_fiqstacktop
+#ifdef __ghs__
+	.type	g_fiqstacktop, $object
+#else
 	.type	g_fiqstacktop, object
+#endif
 
 g_fiqstackalloc:
 	.skip	((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
diff --git a/arch/arm/src/common/gnu/arm_fetchadd.S b/arch/arm/src/common/gnu/arm_fetchadd.S
index 122923d6394..79eb592594f 100644
--- a/arch/arm/src/common/gnu/arm_fetchadd.S
+++ b/arch/arm/src/common/gnu/arm_fetchadd.S
@@ -53,7 +53,11 @@
  ****************************************************************************/
 
 	.globl	up_fetchadd32
+#ifdef __ghs__
+	.type	up_fetchadd32, $function
+#else
 	.type	up_fetchadd32, %function
+#endif
 
 up_fetchadd32:
 
@@ -87,7 +91,11 @@ up_fetchadd32:
  ****************************************************************************/
 
 	.globl	up_fetchsub32
+#ifdef __ghs__
+	.type	up_fetchsub32, $function
+#else
 	.type	up_fetchsub32, %function
+#endif
 
 up_fetchsub32:
 
@@ -121,7 +129,11 @@ up_fetchsub32:
  ****************************************************************************/
 
 	.globl	up_fetchadd16
+#ifdef __ghs__
+	.type	up_fetchadd16, $function
+#else
 	.type	up_fetchadd16, %function
+#endif
 
 up_fetchadd16:
 
@@ -155,7 +167,11 @@ up_fetchadd16:
  ****************************************************************************/
 
 	.globl	up_fetchsub16
+#ifdef __ghs__
+	.type	up_fetchsub16, $function
+#else
 	.type	up_fetchsub16, %function
+#endif
 
 up_fetchsub16:
 
@@ -191,7 +207,11 @@ up_fetchsub16:
  ****************************************************************************/
 
 	.globl	up_fetchadd8
+#ifdef __ghs__
+	.type	up_fetchadd8, $function
+#else
 	.type	up_fetchadd8, %function
+#endif
 
 up_fetchadd8:
 
@@ -225,7 +245,11 @@ up_fetchadd8:
  ****************************************************************************/
 
 	.globl	up_fetchsub8
+#ifdef __ghs__
+	.type	up_fetchsub8, $function
+#else
 	.type	up_fetchsub8, %function
+#endif
 
 up_fetchsub8: