libc: Move cxx_initialize.c from libc/sched/ to libc/misc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-05-03 16:02:30 +08:00 committed by Alin Jerpelea
parent b9eff677fe
commit 577f301a2c
6 changed files with 16 additions and 29 deletions

View File

@ -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)
}

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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.