You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2022/05/04 06:58:49 UTC
[incubator-nuttx] branch master updated (b19b931722 -> 577f301a2c)
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
from b19b931722 arch/xtensa/src/common/xtensa_coproc.S: Use the first allocated memory for the local variable.
new c1082f04d3 libxx: Make HAVE_CXXINITIALIZE workable even HAVE_CXX isn't enabled
new b9eff677fe libc: Simplify the c++ initialization
new 577f301a2c libc: Move cxx_initialize.c from libc/sched/ to libc/misc
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/Kconfig | 1 -
libs/libc/Kconfig | 1 -
libs/libc/libc.h | 4 ++
libs/libc/misc/Make.defs | 1 +
.../lib_cxx_initialize.c} | 16 ++++--
libs/libc/sched/Kconfig | 17 ------
libs/libc/sched/Make.defs | 8 ---
libs/libc/sched/cxx_initialize.h | 21 --------
libs/libc/sched/cxx_initialize_macho.c | 61 ----------------------
libs/libc/sched/task_startup.c | 4 +-
libs/libxx/Kconfig | 18 ++++---
11 files changed, 30 insertions(+), 122 deletions(-)
rename libs/libc/{sched/cxx_initialize_sinit.c => misc/lib_cxx_initialize.c} (92%)
delete mode 100644 libs/libc/sched/Kconfig
delete mode 100644 libs/libc/sched/cxx_initialize.h
delete mode 100644 libs/libc/sched/cxx_initialize_macho.c
[incubator-nuttx] 01/03: libxx: Make HAVE_CXXINITIALIZE workable even HAVE_CXX isn't enabled
Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit c1082f04d3edec2968dcaab16bf2b670e37b5bb8
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue May 3 15:45:40 2022 +0800
libxx: Make HAVE_CXXINITIALIZE workable even HAVE_CXX isn't enabled
since this infrastructure is also used in no c++ case(e.g. gcov)
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/Kconfig | 1 -
libs/libxx/Kconfig | 18 ++++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 49b9332611..079776bd28 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -283,7 +283,6 @@ config ARCH_SIZET_LONG
config ARCH_COVERAGE
bool "Enable code coverage analysis"
- select HAVE_CXX
select HAVE_CXXINITIALIZE
default n
---help---
diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig
index 29a33626ed..600ceb0ce7 100644
--- a/libs/libxx/Kconfig
+++ b/libs/libxx/Kconfig
@@ -20,6 +20,14 @@ config HAVE_CXX
Toolchain supports C++ and CXX, CXXFLAGS, and COMPILEXX have been
defined in the configurations Make.defs file.
+config HAVE_CXXINITIALIZE
+ bool "Have C++ initialization"
+ default n
+ ---help---
+ The platform-specific logic includes support for initialization
+ of static C++ instances for this architecture and for the selected
+ toolchain.
+
if HAVE_CXX
choice
@@ -35,6 +43,7 @@ config LIBCXXMINI
config LIBCXX
bool "LLVM libc++ C++ Standard Library"
+ select HAVE_CXXINITIALIZE
select LIBC_WCHAR
select LIBC_LOCALE
---help---
@@ -43,6 +52,7 @@ config LIBCXX
config UCLIBCXX
bool "uClibc++ Standard C++ Library"
+ select HAVE_CXXINITIALIZE
---help---
uClibc++ C++ library
https://cxx.uclibc.org/
@@ -72,14 +82,6 @@ endchoice
endif
-config HAVE_CXXINITIALIZE
- bool "Have C++ initialization"
- default LIBCXX || UCLIBCXX
- ---help---
- The platform-specific logic includes support for initialization
- of static C++ instances for this architecture and for the selected
- toolchain (via up_cxxinitialize()).
-
config CXX_EXCEPTION
bool "Enable Exception Support"
[incubator-nuttx] 02/03: libc: Simplify the c++ initialization
Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit b9eff677fe1c31b07a01913387dcd7dd3d4a1736
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue May 3 15:54:18 2022 +0800
libc: Simplify the c++ initialization
1.Remove CXX_INITIALIZE_MACHO and CXX_INITIALIZE_SINIT
2.Merge cxx_initialize_sinit.c and cxx_initialize_macho.c into cxx_initialize.c
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
libs/libc/Kconfig | 1 -
libs/libc/sched/Kconfig | 17 ------
libs/libc/sched/Make.defs | 9 +---
.../{cxx_initialize_sinit.c => cxx_initialize.c} | 8 ++-
libs/libc/sched/cxx_initialize_macho.c | 61 ----------------------
5 files changed, 8 insertions(+), 88 deletions(-)
diff --git a/libs/libc/Kconfig b/libs/libc/Kconfig
index 1a36dca660..cf512d886a 100644
--- a/libs/libc/Kconfig
+++ b/libs/libc/Kconfig
@@ -9,7 +9,6 @@ source "libs/libc/stdio/Kconfig"
source "libs/libc/audio/Kconfig"
source "libs/libc/math/Kconfig"
source "libs/libc/machine/Kconfig"
-source "libs/libc/sched/Kconfig"
source "libs/libc/stdlib/Kconfig"
source "libs/libc/unistd/Kconfig"
source "libs/libc/string/Kconfig"
diff --git a/libs/libc/sched/Kconfig b/libs/libc/sched/Kconfig
deleted file mode 100644
index c13df9eed8..0000000000
--- a/libs/libc/sched/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-choice
- prompt "CXX initialization style"
- default CXX_INITIALIZE_MACHO if ARCH_SIM && HOST_MACOS
- default CXX_INITIALIZE_SINIT
-
-config CXX_INITIALIZE_SINIT
- bool "_sinit/_einit style intialization"
-
-config CXX_INITIALIZE_MACHO
- bool "Mach-O style intialization (sim/macOS)"
-
-endchoice
diff --git a/libs/libc/sched/Make.defs b/libs/libc/sched/Make.defs
index f3881bc1e0..71c063731d 100644
--- a/libs/libc/sched/Make.defs
+++ b/libs/libc/sched/Make.defs
@@ -23,6 +23,7 @@
CSRCS += sched_getprioritymax.c sched_getprioritymin.c
CSRCS += clock_ticks2time.c clock_time2ticks.c
CSRCS += clock_timespec_add.c clock_timespec_subtract.c
+CSRCS += cxx_initialize.c
ifneq ($(CONFIG_CANCELLATION_POINTS),y)
CSRCS += task_setcanceltype.c task_testcancel.c
@@ -35,14 +36,6 @@ endif
ifneq ($(CONFIG_BUILD_KERNEL),y)
CSRCS += task_startup.c
-ifeq ($(CONFIG_CXX_INITIALIZE_SINIT),y)
-CSRCS += cxx_initialize_sinit.c
-endif
-
-ifeq ($(CONFIG_CXX_INITIALIZE_MACHO),y)
-CSRCS += cxx_initialize_macho.c
-endif
-
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
CSRCS += sched_dumpstack.c sched_backtrace.c
endif
diff --git a/libs/libc/sched/cxx_initialize_sinit.c b/libs/libc/sched/cxx_initialize.c
similarity index 95%
rename from libs/libc/sched/cxx_initialize_sinit.c
rename to libs/libc/sched/cxx_initialize.c
index 1fcc0dcd63..b8e21b5a7e 100644
--- a/libs/libc/sched/cxx_initialize_sinit.c
+++ b/libs/libc/sched/cxx_initialize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * libs/libc/sched/cxx_initialize_sinit.c
+ * libs/libc/sched/cxx_initialize.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -82,6 +82,11 @@ void cxx_initialize(void)
if (inited == 0)
{
+#if defined(CONFIG_ARCH_SIM) && defined(CONFIG_HOST_MACOS)
+ extern void macho_call_saved_init_funcs(void);
+
+ macho_call_saved_init_funcs();
+#else
initializer_t *initp;
sinfo("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
@@ -106,6 +111,7 @@ void cxx_initialize(void)
initializer();
}
}
+#endif
inited = 1;
}
diff --git a/libs/libc/sched/cxx_initialize_macho.c b/libs/libc/sched/cxx_initialize_macho.c
deleted file mode 100644
index ca9cf7fd40..0000000000
--- a/libs/libc/sched/cxx_initialize_macho.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
- * libs/libc/sched/cxx_initialize_macho.c
- *
- * 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/config.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: cxx_initialize
- *
- * Description:
- * If C++ and C++ static constructors are supported, then this function
- * must be provided by board-specific logic in order to perform
- * initialization of the static C++ class instances.
- *
- * This function should then be called in the application-specific
- * user_start logic in order to perform the C++ initialization. NOTE
- * that no component of the core NuttX RTOS logic is involved; this
- * function definition only provides the 'contract' between application
- * specific C++ code and platform-specific toolchain support.
- *
- ****************************************************************************/
-
-void cxx_initialize(void)
-{
-#ifdef CONFIG_HAVE_CXXINITIALIZE
- static int inited = 0;
-
- if (inited == 0)
- {
- extern void macho_call_saved_init_funcs(void);
-
- macho_call_saved_init_funcs();
-
- inited = 1;
- }
-#endif
-}
[incubator-nuttx] 03/03: libc: Move cxx_initialize.c from libc/sched/ to libc/misc
Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 577f301a2c4193c10c8d96e628fa7592ee8593c2
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue May 3 16:02:30 2022 +0800
libc: Move cxx_initialize.c from libc/sched/ to libc/misc
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
libs/libc/libc.h | 4 ++++
libs/libc/misc/Make.defs | 1 +
.../cxx_initialize.c => misc/lib_cxx_initialize.c} | 14 +++++++++-----
libs/libc/sched/Make.defs | 1 -
libs/libc/sched/cxx_initialize.h | 21 ---------------------
libs/libc/sched/task_startup.c | 4 ++--
6 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/libs/libc/libc.h b/libs/libc/libc.h
index 7e2c2a6332..a295e89a1a 100644
--- a/libs/libc/libc.h
+++ b/libs/libc/libc.h
@@ -158,6 +158,10 @@ ssize_t lib_parse_hostfile(FAR FILE *stream, FAR struct hostent *host,
int lib_restoredir(void);
#endif
+/* Defined in lib_cxx_initialize.c */
+
+void lib_cxx_initialize(void);
+
#undef EXTERN
#if defined(__cplusplus)
}
diff --git a/libs/libc/misc/Make.defs b/libs/libc/misc/Make.defs
index a4c8bc8ce9..3e25e4038a 100644
--- a/libs/libc/misc/Make.defs
+++ b/libs/libc/misc/Make.defs
@@ -22,6 +22,7 @@
CSRCS += lib_mknod.c lib_umask.c lib_utsname.c lib_getrandom.c
CSRCS += lib_xorshift128.c lib_tea_encrypt.c lib_tea_decrypt.c
+CSRCS += lib_cxx_initialize.c
# Support for platforms that do not have long long types
diff --git a/libs/libc/sched/cxx_initialize.c b/libs/libc/misc/lib_cxx_initialize.c
similarity index 94%
rename from libs/libc/sched/cxx_initialize.c
rename to libs/libc/misc/lib_cxx_initialize.c
index b8e21b5a7e..898a4efc52 100644
--- a/libs/libc/sched/cxx_initialize.c
+++ b/libs/libc/misc/lib_cxx_initialize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * libs/libc/sched/cxx_initialize.c
+ * libs/libc/misc/lib_cxx_initialize.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -29,6 +29,8 @@
#include <sched.h>
#include <stdlib.h>
+#include "libc.h"
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -55,12 +57,16 @@ extern initializer_t _einit;
extern uintptr_t _stext;
extern uintptr_t _etext;
+#if defined(CONFIG_ARCH_SIM) && defined(CONFIG_HOST_MACOS)
+extern void macho_call_saved_init_funcs(void);
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
- * Name: cxx_initialize
+ * Name: lib_cxx_initialize
*
* Description:
* If C++ and C++ static constructors are supported, then this function
@@ -75,7 +81,7 @@ extern uintptr_t _etext;
*
****************************************************************************/
-void cxx_initialize(void)
+void lib_cxx_initialize(void)
{
#ifdef CONFIG_HAVE_CXXINITIALIZE
static int inited = 0;
@@ -83,8 +89,6 @@ void cxx_initialize(void)
if (inited == 0)
{
#if defined(CONFIG_ARCH_SIM) && defined(CONFIG_HOST_MACOS)
- extern void macho_call_saved_init_funcs(void);
-
macho_call_saved_init_funcs();
#else
initializer_t *initp;
diff --git a/libs/libc/sched/Make.defs b/libs/libc/sched/Make.defs
index 71c063731d..70b95c614f 100644
--- a/libs/libc/sched/Make.defs
+++ b/libs/libc/sched/Make.defs
@@ -23,7 +23,6 @@
CSRCS += sched_getprioritymax.c sched_getprioritymin.c
CSRCS += clock_ticks2time.c clock_time2ticks.c
CSRCS += clock_timespec_add.c clock_timespec_subtract.c
-CSRCS += cxx_initialize.c
ifneq ($(CONFIG_CANCELLATION_POINTS),y)
CSRCS += task_setcanceltype.c task_testcancel.c
diff --git a/libs/libc/sched/cxx_initialize.h b/libs/libc/sched/cxx_initialize.h
deleted file mode 100644
index e8fd6549d9..0000000000
--- a/libs/libc/sched/cxx_initialize.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/****************************************************************************
- * libs/libc/sched/cxx_initialize.h
- *
- * 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.
- *
- ****************************************************************************/
-
-void cxx_initialize(void);
diff --git a/libs/libc/sched/task_startup.c b/libs/libc/sched/task_startup.c
index 76a03f5291..a723be05f9 100644
--- a/libs/libc/sched/task_startup.c
+++ b/libs/libc/sched/task_startup.c
@@ -29,7 +29,7 @@
#include <assert.h>
#include <debug.h>
-#include "cxx_initialize.h"
+#include "libc.h"
#ifndef CONFIG_BUILD_KERNEL
@@ -61,7 +61,7 @@ void nxtask_startup(main_t entrypt, int argc, FAR char *argv[])
* that first
*/
- cxx_initialize();
+ lib_cxx_initialize();
/* Call the 'main' entry point passing argc and argv, calling exit()
* if/when the task returns.