summaryrefslogtreecommitdiff
path: root/src/module.c
diff options
context:
space:
mode:
authorUrey <[email protected]>2017-09-06 11:16:51 +0800
committerGitHub <[email protected]>2017-09-06 11:16:51 +0800
commitad1d3375f222c5746514ab16003dc18c0df83dad (patch)
tree4572af3fcf6b592a714e2ec76b25dae27a1ecea6 /src/module.c
parent94746d8e5f69b26535f75b730e7540caf42863fa (diff)
parentbc225a5ef05a9b14dd72286402093cbb7dba8305 (diff)
Merge pull request #1 from RT-Thread/master
同步 rt-thread master
Diffstat (limited to 'src/module.c')
-rw-r--r--src/module.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c
index c1a3475655..888701930d 100644
--- a/src/module.c
+++ b/src/module.c
@@ -27,6 +27,7 @@
* 2012-11-23 Bernard using RT_DEBUG_LOG instead of rt_kprintf.
* 2012-11-28 Bernard remove rt_current_module and user
* can use rt_module_unload to remove a module.
+ * 2017-08-20 parai support intel 386 machine
*/
#include <rthw.h>
@@ -223,6 +224,10 @@ static int rt_module_arm_relocate(struct rt_module *module,
*where &= 0xf000000f;
*where |= 0x01a0f000;
break;
+#ifdef MODULE_USING_386
+ case R_386_GLOB_DAT:
+ case R_386_JUMP_SLOT:
+#endif
case R_ARM_GLOB_DAT:
case R_ARM_JUMP_SLOT:
*where = (Elf32_Addr)sym_val;
@@ -237,6 +242,9 @@ static int rt_module_arm_relocate(struct rt_module *module,
where, *where, sym_val));
break;
#endif
+#ifdef MODULE_USING_386
+ case R_386_RELATIVE:
+#endif
case R_ARM_RELATIVE:
*where = (Elf32_Addr)sym_val + *where;
RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_RELATIVE: 0x%x -> 0x%x 0x%x\n",
@@ -543,7 +551,11 @@ static struct rt_module *_load_shared_object(const char *name,
sym->st_shndx));
if ((sym->st_shndx != SHT_NULL) ||
- (ELF_ST_BIND(sym->st_info) == STB_LOCAL))
+ (ELF_ST_BIND(sym->st_info) == STB_LOCAL)
+#ifdef MODULE_USING_386
+ || ( (ELF_ST_BIND(sym->st_info) == STB_GLOBAL) && (ELF_ST_TYPE(sym->st_info) == STT_OBJECT) )
+#endif
+ )
{
rt_module_arm_relocate(module, rel,
(Elf32_Addr)(module->module_space