summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2022-01-20 07:55:31 -0500
committerGitHub <[email protected]>2022-01-20 20:55:31 +0800
commitc89735a357dda9f3249a90346e033b64e5a1a499 (patch)
tree2540b2e125ca0432cce39f566f5d39f49686e069 /components
parent3606065803205b03f0e3f07f3791297799639dba (diff)
[libdl] move libdl to posix folder (#5523)
Diffstat (limited to 'components')
-rw-r--r--components/libc/Kconfig10
-rw-r--r--components/libc/compilers/gcc/newlib/dlsyms.c (renamed from components/libc/compilers/armlibc/libc_syms.c)46
-rw-r--r--components/libc/posix/Kconfig10
-rw-r--r--components/libc/posix/libdl/SConscript (renamed from components/libc/libdl/SConscript)4
-rw-r--r--components/libc/posix/libdl/arch/arm.c (renamed from components/libc/libdl/arch/arm.c)0
-rw-r--r--components/libc/posix/libdl/arch/riscv.c (renamed from components/libc/libdl/arch/riscv.c)0
-rw-r--r--components/libc/posix/libdl/arch/x86.c (renamed from components/libc/libdl/arch/x86.c)0
-rw-r--r--components/libc/posix/libdl/dlclose.c (renamed from components/libc/libdl/dlclose.c)0
-rw-r--r--components/libc/posix/libdl/dlelf.c (renamed from components/libc/libdl/dlelf.c)0
-rw-r--r--components/libc/posix/libdl/dlelf.h (renamed from components/libc/libdl/dlelf.h)0
-rw-r--r--components/libc/posix/libdl/dlerror.c (renamed from components/libc/libdl/dlerror.c)0
-rw-r--r--components/libc/posix/libdl/dlfcn.h (renamed from components/libc/libdl/dlfcn.h)0
-rw-r--r--components/libc/posix/libdl/dlmodule.c (renamed from components/libc/libdl/dlmodule.c)14
-rw-r--r--components/libc/posix/libdl/dlmodule.h (renamed from components/libc/libdl/dlmodule.h)0
-rw-r--r--components/libc/posix/libdl/dlopen.c (renamed from components/libc/libdl/dlopen.c)0
-rw-r--r--components/libc/posix/libdl/dlsym.c (renamed from components/libc/libdl/dlsym.c)0
16 files changed, 46 insertions, 38 deletions
diff --git a/components/libc/Kconfig b/components/libc/Kconfig
index 0556cf6183..71547e7970 100644
--- a/components/libc/Kconfig
+++ b/components/libc/Kconfig
@@ -1,15 +1,5 @@
menu "POSIX layer and C standard library"
-config RT_USING_MODULE
- bool "Enable dynamic module with dlopen/dlsym/dlclose feature"
- default n
-
-if RT_USING_MODULE
- config RT_USING_CUSTOM_DLMODULE
- bool "Enable load dynamic module by custom"
- default n
-endif
-
config RT_LIBC_DEFAULT_TIMEZONE
int "Set the default time zone (UTC+)"
range -12 12
diff --git a/components/libc/compilers/armlibc/libc_syms.c b/components/libc/compilers/gcc/newlib/dlsyms.c
index 2b370a25a6..e6ca23b393 100644
--- a/components/libc/compilers/armlibc/libc_syms.c
+++ b/components/libc/compilers/gcc/newlib/dlsyms.c
@@ -5,25 +5,26 @@
*
* Change Logs:
* Date Author Notes
+ * 2017/10/15 bernard the first version
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
+#include <rtthread.h>
#include <rtm.h>
-/* some export routines for module */
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
-RTM_EXPORT(strstr);
-RTM_EXPORT(strlen);
-RTM_EXPORT(strchr);
RTM_EXPORT(strcpy);
RTM_EXPORT(strncpy);
-RTM_EXPORT(strcmp);
-RTM_EXPORT(strncmp);
+RTM_EXPORT(strlen);
RTM_EXPORT(strcat);
+RTM_EXPORT(strstr);
+RTM_EXPORT(strchr);
+RTM_EXPORT(strcmp);
RTM_EXPORT(strtol);
+RTM_EXPORT(strtoul);
+RTM_EXPORT(strncmp);
RTM_EXPORT(memcpy);
RTM_EXPORT(memcmp);
@@ -31,13 +32,22 @@ RTM_EXPORT(memmove);
RTM_EXPORT(memset);
RTM_EXPORT(memchr);
-RTM_EXPORT(toupper);
-RTM_EXPORT(atoi);
-
-/* import the full stdio for printf */
-#if defined(RT_USING_MODULE) && defined(__MICROLIB)
-#error "[RT_USING_LIBC] Please use standard libc but not microlib."
-#endif
-
+RTM_EXPORT(putchar);
RTM_EXPORT(puts);
RTM_EXPORT(printf);
+RTM_EXPORT(sprintf);
+RTM_EXPORT(snprintf);
+
+RTM_EXPORT(fwrite);
+
+#include <setjmp.h>
+RTM_EXPORT(longjmp);
+RTM_EXPORT(setjmp);
+
+RTM_EXPORT(exit);
+RTM_EXPORT(abort);
+
+RTM_EXPORT(rand);
+
+#include <assert.h>
+RTM_EXPORT(__assert_func);
diff --git a/components/libc/posix/Kconfig b/components/libc/posix/Kconfig
index 8f527fa46d..5c766d9509 100644
--- a/components/libc/posix/Kconfig
+++ b/components/libc/posix/Kconfig
@@ -65,6 +65,16 @@ if RT_USING_PTHREADS
default 8
endif
+config RT_USING_MODULE
+ bool "Enable dynamic module with dlopen/dlsym/dlclose feature"
+ default n
+
+if RT_USING_MODULE
+ config RT_USING_CUSTOM_DLMODULE
+ bool "Enable load dynamic module by custom"
+ default n
+endif
+
source "$RTT_DIR/components/libc/posix/ipc/Kconfig"
endmenu
diff --git a/components/libc/libdl/SConscript b/components/libc/posix/libdl/SConscript
index 93636e4b7a..964e05ef76 100644
--- a/components/libc/libdl/SConscript
+++ b/components/libc/posix/libdl/SConscript
@@ -7,8 +7,6 @@ group = []
CPPPATH = [cwd]
if rtconfig.PLATFORM == 'gcc':
- group = DefineGroup('libc', src,
- depend = ['RT_USING_MODULE'],
- CPPPATH = CPPPATH)
+ group = DefineGroup('POSIX', src, depend = ['RT_USING_MODULE'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/libc/libdl/arch/arm.c b/components/libc/posix/libdl/arch/arm.c
index 6a884bdb54..6a884bdb54 100644
--- a/components/libc/libdl/arch/arm.c
+++ b/components/libc/posix/libdl/arch/arm.c
diff --git a/components/libc/libdl/arch/riscv.c b/components/libc/posix/libdl/arch/riscv.c
index c7c454e168..c7c454e168 100644
--- a/components/libc/libdl/arch/riscv.c
+++ b/components/libc/posix/libdl/arch/riscv.c
diff --git a/components/libc/libdl/arch/x86.c b/components/libc/posix/libdl/arch/x86.c
index e7ad714a03..e7ad714a03 100644
--- a/components/libc/libdl/arch/x86.c
+++ b/components/libc/posix/libdl/arch/x86.c
diff --git a/components/libc/libdl/dlclose.c b/components/libc/posix/libdl/dlclose.c
index 876a1576c8..876a1576c8 100644
--- a/components/libc/libdl/dlclose.c
+++ b/components/libc/posix/libdl/dlclose.c
diff --git a/components/libc/libdl/dlelf.c b/components/libc/posix/libdl/dlelf.c
index 418ad7539a..418ad7539a 100644
--- a/components/libc/libdl/dlelf.c
+++ b/components/libc/posix/libdl/dlelf.c
diff --git a/components/libc/libdl/dlelf.h b/components/libc/posix/libdl/dlelf.h
index 339e172bb4..339e172bb4 100644
--- a/components/libc/libdl/dlelf.h
+++ b/components/libc/posix/libdl/dlelf.h
diff --git a/components/libc/libdl/dlerror.c b/components/libc/posix/libdl/dlerror.c
index de948eb16b..de948eb16b 100644
--- a/components/libc/libdl/dlerror.c
+++ b/components/libc/posix/libdl/dlerror.c
diff --git a/components/libc/libdl/dlfcn.h b/components/libc/posix/libdl/dlfcn.h
index f5c9063f2f..f5c9063f2f 100644
--- a/components/libc/libdl/dlfcn.h
+++ b/components/libc/posix/libdl/dlfcn.h
diff --git a/components/libc/libdl/dlmodule.c b/components/libc/posix/libdl/dlmodule.c
index 32d6b6b7e7..ffa23de82d 100644
--- a/components/libc/libdl/dlmodule.c
+++ b/components/libc/posix/libdl/dlmodule.c
@@ -14,7 +14,7 @@
#include "dlmodule.h"
#include "dlelf.h"
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
#include <unistd.h>
#include <sys/stat.h>
#include <sys/statfs.h>
@@ -423,14 +423,14 @@ struct rt_dlmodule *rt_module_self(void)
struct rt_dlmodule* dlmodule_load(const char* filename)
{
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
int fd = -1, length = 0;
#endif
rt_err_t ret = RT_EOK;
rt_uint8_t *module_ptr = RT_NULL;
struct rt_dlmodule *module = RT_NULL;
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
fd = open(filename, O_RDONLY, 0);
if (fd >= 0)
{
@@ -522,7 +522,7 @@ struct rt_dlmodule* dlmodule_load(const char* filename)
return module;
__exit:
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
if (fd >= 0) close(fd);
#endif
if (module_ptr) rt_free(module_ptr);
@@ -573,7 +573,7 @@ struct rt_dlmodule* dlmodule_exec(const char* pgname, const char* cmd, int cmd_s
#if defined(RT_USING_CUSTOM_DLMODULE)
struct rt_dlmodule* dlmodule_load_custom(const char* filename, struct rt_dlmodule_ops* ops)
{
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
int fd = -1, length = 0;
#endif
rt_err_t ret = RT_EOK;
@@ -586,7 +586,7 @@ struct rt_dlmodule* dlmodule_load_custom(const char* filename, struct rt_dlmodul
RT_ASSERT(ops->unload);
module_ptr = ops->load(filename);
}
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
else
{
fd = open(filename, O_RDONLY, 0);
@@ -688,7 +688,7 @@ struct rt_dlmodule* dlmodule_load_custom(const char* filename, struct rt_dlmodul
return module;
__exit:
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_FS
if (fd >= 0) close(fd);
#endif
if (module_ptr)
diff --git a/components/libc/libdl/dlmodule.h b/components/libc/posix/libdl/dlmodule.h
index 183faca159..183faca159 100644
--- a/components/libc/libdl/dlmodule.h
+++ b/components/libc/posix/libdl/dlmodule.h
diff --git a/components/libc/libdl/dlopen.c b/components/libc/posix/libdl/dlopen.c
index bcb57d78f0..bcb57d78f0 100644
--- a/components/libc/libdl/dlopen.c
+++ b/components/libc/posix/libdl/dlopen.c
diff --git a/components/libc/libdl/dlsym.c b/components/libc/posix/libdl/dlsym.c
index f7c1c901fd..f7c1c901fd 100644
--- a/components/libc/libdl/dlsym.c
+++ b/components/libc/posix/libdl/dlsym.c