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 004f00d16fcffaed55dd49054eb818b5d1246848
Author: v-zhangxiaomeng5 <[email protected]>
AuthorDate: Fri Nov 27 20:57:29 2026 +0800

    arch/tricore: provide empty C++ initializer bounds for TASKING
    
    TASKING does not use .init_array for C++ static initialization. Alias 
_einit to _sinit so the common C++ initialization loop is empty.
    
    Place the definitions in the TriCore libc machine directory and register 
them for both CMake and Make builds.
    
    Signed-off-by: v-zhangxiaomeng5 <[email protected]>
---
 libs/libc/machine/tricore/CMakeLists.txt           |  4 ++
 libs/libc/machine/tricore/Make.defs                |  4 ++
 libs/libc/machine/tricore/tricore_cxx_initialize.c | 49 ++++++++++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/libs/libc/machine/tricore/CMakeLists.txt 
b/libs/libc/machine/tricore/CMakeLists.txt
index af9b3f05eee..bc1fbd851f8 100644
--- a/libs/libc/machine/tricore/CMakeLists.txt
+++ b/libs/libc/machine/tricore/CMakeLists.txt
@@ -92,6 +92,10 @@ if(CONFIG_LIBC_ARCH_STPCPY)
   list(APPEND SRCS ${TRICORE_SUBDIR}/arch_stpcpy.${ASMEXT})
 endif()
 
+if(CONFIG_TRICORE_TOOLCHAIN_TASKING)
+  list(APPEND SRCS tricore_cxx_initialize.c)
+endif()
+
 target_include_directories(c PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 
 target_sources(c PRIVATE ${SRCS})
diff --git a/libs/libc/machine/tricore/Make.defs 
b/libs/libc/machine/tricore/Make.defs
index 16ff94b4b06..a25c9ea56d9 100644
--- a/libs/libc/machine/tricore/Make.defs
+++ b/libs/libc/machine/tricore/Make.defs
@@ -92,6 +92,10 @@ ifeq ($(CONFIG_LIBC_ARCH_STPCPY),y)
 ASRCS += arch_stpcpy$(ASMEXT)
 endif
 
+ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
+CSRCS += tricore_cxx_initialize.c
+endif
+
 DEPPATH += --dep-path machine/tricore/$(TRICORE_SUBDIR)
 DEPPATH += --dep-path machine/tricore
 VPATH += :machine/tricore/$(TRICORE_SUBDIR)
diff --git a/libs/libc/machine/tricore/tricore_cxx_initialize.c 
b/libs/libc/machine/tricore/tricore_cxx_initialize.c
new file mode 100644
index 00000000000..0512aea741a
--- /dev/null
+++ b/libs/libc/machine/tricore/tricore_cxx_initialize.c
@@ -0,0 +1,49 @@
+/****************************************************************************
+ * libs/libc/machine/tricore/tricore_cxx_initialize.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/arch.h>
+#include <nuttx/compiler.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
+initializer_t _sinit[] =
+{
+  NULL
+};
+
+extern initializer_t __attribute__((alias ("_sinit"))) _einit[];
+#endif /* CONFIG_TRICORE_TOOLCHAIN_TASKING */
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/

Reply via email to