diff options
| author | parai <[email protected]> | 2017-08-20 20:24:07 +0800 |
|---|---|---|
| committer | parai <[email protected]> | 2017-08-20 20:24:07 +0800 |
| commit | 2957cf6f52f54fe06325d0595b3f535477cf2262 (patch) | |
| tree | eb8e5489db07f76e9a2a01fd4e97ac8e1ee7ae89 /components/libc/libdl | |
| parent | 0cd49a20ad0c8cbb40e200d25595e345e56ce735 (diff) | |
x86: bring up share object module on i386 machine
1. upddate kernel module to support i386
2. update libdl to support open *.so by absolute path
3. new test case bsp/x86/src/hello.c to test i386 module feature
Signed-off-by: parai <[email protected]>
Diffstat (limited to 'components/libc/libdl')
| -rw-r--r-- | components/libc/libdl/dlopen.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/components/libc/libdl/dlopen.c b/components/libc/libdl/dlopen.c index 5e063eed96..2c091079b2 100644 --- a/components/libc/libdl/dlopen.c +++ b/components/libc/libdl/dlopen.c @@ -27,7 +27,7 @@ void* dlopen(const char *filename, int flags) /* check parameters */ RT_ASSERT(filename != RT_NULL); - if (filename[0] != '/') /* it's a absolute path, use it directly */ + if (filename[0] != '/') /* it's a relative path, prefix with MODULE_ROOT_DIR */ { fullpath = rt_malloc(strlen(def_path) + strlen(filename) + 2); @@ -37,8 +37,7 @@ void* dlopen(const char *filename, int flags) } else { - rt_kprintf("use absolute path\n"); - return RT_NULL; + fullpath = (char*)filename; /* absolute path, use it directly */ } /* find in module list */ @@ -47,7 +46,11 @@ void* dlopen(const char *filename, int flags) if(module != RT_NULL) module->nref++; else module = rt_module_open(fullpath); - rt_free(fullpath); + if(fullpath != filename) + { + rt_free(fullpath); + } + return (void*)module; } |
