This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 6e65ff768f8f73c6af9c72be45ba9f67c926a4ba Author: jinqiankun1 <[email protected]> AuthorDate: Fri Mar 6 15:04:11 2026 +0800 arch/tricore: add orphan section check for gcc Add CONFIG_DEBUG_LINK_ORPHAN_WARN to pass --orphan-handling=warn to the GNU linker, so input sections that are not placed by the board linker script are reported instead of being silently put somewhere. Signed-off-by: jinqiankun1 <[email protected]> --- Kconfig | 4 ++++ arch/tricore/src/cmake/gcc.cmake | 4 ++++ arch/tricore/src/common/ToolchainGnuc.defs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Kconfig b/Kconfig index e8c72ecfc64..500f0901390 100644 --- a/Kconfig +++ b/Kconfig @@ -2988,6 +2988,10 @@ config ITERABLE_SECTIONS_LINKER_INSERT rwx region at a lower address first (e.g. ITCM at 0x0) must use the common-rom.ld include instead. +config DEBUG_LINK_ORPHAN_WARN + bool "Warn on orphan section handling" + default n + config CCACHE bool "Use ccache" default n diff --git a/arch/tricore/src/cmake/gcc.cmake b/arch/tricore/src/cmake/gcc.cmake index 9cabe97f4de..872c9920ce6 100644 --- a/arch/tricore/src/cmake/gcc.cmake +++ b/arch/tricore/src/cmake/gcc.cmake @@ -162,3 +162,7 @@ endif() if(NOT CONFIG_CXX_RTTI) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>) endif() + +if(CONFIG_DEBUG_LINK_ORPHAN_WARN) + add_link_options(-Wl,--orphan-handling=warn) +endif() diff --git a/arch/tricore/src/common/ToolchainGnuc.defs b/arch/tricore/src/common/ToolchainGnuc.defs index 34355601e49..106ab4d5b24 100644 --- a/arch/tricore/src/common/ToolchainGnuc.defs +++ b/arch/tricore/src/common/ToolchainGnuc.defs @@ -172,6 +172,10 @@ endif LDFLAGS += --no-warn-rwx-segments +ifeq ($(CONFIG_DEBUG_LINK_ORPHAN_WARN),y) + LDFLAGS += --orphan-handling=warn +endif + # Add the builtin library COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
