libxx: Make __dso_handle weak

since sim arch has to use other instance provided by host glibc
also initialize __dso_handle to self as glibc:
https://github.com/bminor/glibc/blob/master/csu/dso_handle.c#L21

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7531ae58fc4dbe4600bcb2c2c3a6cac021378bc1
This commit is contained in:
Xiang Xiao 2020-07-08 11:19:14 +08:00 committed by Masayuki Ishikawa
parent 81d814b86e
commit c3e256e018
3 changed files with 8 additions and 2 deletions

View File

@ -82,11 +82,13 @@
# define CONFIG_HAVE_WEAKFUNCTIONS 1
# define weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
# define weak_data __attribute__ ((weak))
# define weak_function __attribute__ ((weak))
# define weak_const_function __attribute__ ((weak, __const__))
# else
# undef CONFIG_HAVE_WEAKFUNCTIONS
# define weak_alias(name, aliasname)
# define weak_data
# define weak_function
# define weak_const_function
# endif
@ -324,6 +326,7 @@
# undef CONFIG_HAVE_WEAKFUNCTIONS
# define weak_alias(name, aliasname)
# define weak_data
# define weak_function
# define weak_const_function
# define restrict /* REVISIT */
@ -462,6 +465,7 @@
# undef CONFIG_HAVE_WEAKFUNCTIONS
# define weak_alias(name, aliasname)
# define weak_data
# define weak_function
# define weak_const_function
# define restrict
@ -565,6 +569,7 @@
# define UNUSED(a) ((void)(a))
# define weak_alias(name, aliasname)
# define weak_data __weak
# define weak_function __weak
# define weak_const_function
# define noreturn_function
@ -618,6 +623,7 @@
# undef CONFIG_HAVE_WEAKFUNCTIONS
# undef CONFIG_HAVE_CXX14
# define weak_alias(name, aliasname)
# define weak_data
# define weak_function
# define weak_const_function
# define restrict

View File

@ -76,7 +76,7 @@ typedef CODE void (*__cxa_exitfunc_t)(void *arg);
// Public Data
//***************************************************************************
extern "C" FAR void *__dso_handle;
extern "C" FAR void *__dso_handle weak_data;
//***************************************************************************
// Public Function Prototypes

View File

@ -67,7 +67,7 @@ extern "C"
// Public Data
//*************************************************************************
FAR void *__dso_handle = NULL;
FAR void *__dso_handle = &__dso_handle;
//*************************************************************************
// Private Functions