From c07d076bf5a7003272ca30374cf24f16637f392a Mon Sep 17 00:00:00 2001 From: chao an Date: Thu, 22 Sep 2022 18:02:31 +0800 Subject: [PATCH] arch/arm: redefine the linker symbols as armlink style Signed-off-by: chao an --- arch/arm/include/arch.h | 7 +++++++ arch/arm/src/common/Toolchain.defs | 16 ++++++++++++++++ arch/arm/src/common/arm_internal.h | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/arch/arm/include/arch.h b/arch/arm/include/arch.h index 4596908115..bec81e41af 100644 --- a/arch/arm/include/arch.h +++ b/arch/arm/include/arch.h @@ -104,6 +104,13 @@ do { \ # endif #endif /* CONFIG_ARCH_ADDRENV */ +/* Redefine the linker symbols as armlink style */ + +#ifdef CONFIG_ARM_TOOLCHAIN_ARMCLANG +# define _sinit Image$$init_section$$Base +# define _einit Image$$init_section$$Limit +#endif + /**************************************************************************** * Inline functions ****************************************************************************/ diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index ffe4d44534..8c71515b9a 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -163,6 +163,22 @@ else ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y) ARCHCPUFLAGS += -Wno-license-management LDFLAGS += --diag_suppress=9931 + # Input sections are specified even though there will be no such + # sections found in the libraries linked. + # Warning: L6314W: No section matches pattern *(xxx). + + LDFLAGS += --diag_suppress=6314 + + # Allow Empty Execution region declared on scatter + # Warning: L6312W: Empty Execution region description for region xxx + + LDFLAGS += --diag_suppress=6312 + + # Match pattern for an unused section that is being removed. + # Warning: L6329W: Pattern xxx only matches removed unused sections. + + LDFLAGS += --diag_suppress=6329 + # Default toolchain else diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index bc838fe4d1..fcd5e20686 100644 --- a/arch/arm/src/common/arm_internal.h +++ b/arch/arm/src/common/arm_internal.h @@ -148,6 +148,24 @@ #define arm_switchcontext(saveregs, restoreregs) \ sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs); +/* Redefine the linker symbols as armlink style */ + +#ifdef CONFIG_ARM_TOOLCHAIN_ARMCLANG +# define _stext Image$$text$$Base +# define _etext Image$$text$$Limit +# define _eronly Image$$eronly$$Base +# define _sdata Image$$data$$Base +# define _edata Image$$data$$RW$$Limit +# define _sbss Image$$bss$$Base +# define _ebss Image$$bss$$ZI$$Limit +# define _stdata Image$$tdata$$Base +# define _etdata Image$$tdata$$Limit +# define _stbss Image$$tbss$$Base +# define _etbss Image$$tbss$$Limit +# define _snoinit Image$$noinit$$Base +# define _enoinit Image$$noinit$$Limit +#endif + /**************************************************************************** * Public Types ****************************************************************************/