summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2017-08-21 09:30:17 +0800
committerGitHub <[email protected]>2017-08-21 09:30:17 +0800
commit1f45d8c723cf8fd91a2f0ac6fec5ac9789c4cf66 (patch)
treec4d4d60ef82f5380fd60b86599e405e31fdd6676 /src
parent76a79f20d999bf6b2d77883967e19dad8ffc0604 (diff)
parent2957cf6f52f54fe06325d0595b3f535477cf2262 (diff)
Merge pull request #822 from parai/upstream
x86: bring up share object module on i386 machine
Diffstat (limited to 'src')
-rw-r--r--src/module.c14
-rw-r--r--src/module.h7
2 files changed, 20 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
diff --git a/src/module.h b/src/module.h
index 1ae9eedbec..90d4dc9524 100644
--- a/src/module.h
+++ b/src/module.h
@@ -208,6 +208,13 @@ typedef struct
#define R_ARM_THM_JUMP24 30
#define R_ARM_V4BX 40
+/*
+ * Relocation type for arm
+ */
+#define R_386_GLOB_DAT 6
+#define R_386_JUMP_SLOT 7
+#define R_386_RELATIVE 8
+
/* Program Header */
typedef struct
{