update elf loader

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1200 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2010-12-13 14:17:00 +00:00
parent 12750c38b8
commit 179bdeca6c
2 changed files with 9 additions and 2 deletions

View File

@ -164,6 +164,10 @@ static int rt_module_arm_relocate(struct rt_module* module, Elf32_Rel *rel, Elf3
#endif #endif
break; break;
case R_ARM_RELATIVE: case R_ARM_RELATIVE:
*where += (Elf32_Addr)sym_val;
#ifdef RT_MODULE_DEBUG
rt_kprintf("R_ARM_RELATIVE: 0x%x -> 0x%x 0x%x\n", where, *where, sym_val);
#endif
break; break;
default: default:
return -1; return -1;
@ -339,7 +343,7 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr)
#ifdef RT_MODULE_DEBUG #ifdef RT_MODULE_DEBUG
rt_kprintf("relocate symbol %s shndx %d\n", strtab + sym->st_name, sym->st_shndx); rt_kprintf("relocate symbol %s shndx %d\n", strtab + sym->st_name, sym->st_shndx);
#endif #endif
if(sym->st_shndx != SHT_NULL || ELF_ST_TYPE(sym->st_info) == STB_LOCAL ) if((sym->st_shndx != SHT_NULL) || (ELF_ST_BIND(sym->st_info) == STB_LOCAL))
{ {
rt_module_arm_relocate( rt_module_arm_relocate(
module, module,

View File

@ -154,6 +154,7 @@ RTM_EXPORT(rt_sprintf)
/* /*
* misc interface symbol * misc interface symbol
*/ */
extern int __aeabi_idiv;
extern int __aeabi_ddiv; extern int __aeabi_ddiv;
extern int __aeabi_dmul; extern int __aeabi_dmul;
extern int __aeabi_i2d; extern int __aeabi_i2d;
@ -165,10 +166,12 @@ RTM_EXPORT(__aeabi_ddiv)
RTM_EXPORT(__aeabi_dmul) RTM_EXPORT(__aeabi_dmul)
RTM_EXPORT(__aeabi_i2d) RTM_EXPORT(__aeabi_i2d)
RTM_EXPORT(__aeabi_uidiv) RTM_EXPORT(__aeabi_uidiv)
RTM_EXPORT(__aeabi_idiv)
RTM_EXPORT(__aeabi_uidivmod) RTM_EXPORT(__aeabi_uidivmod)
RTM_EXPORT(__aeabi_d2iz) RTM_EXPORT(__aeabi_d2iz)
RTM_EXPORT(strcmp) RTM_EXPORT(strcmp)
RTM_EXPORT(rand) RTM_EXPORT(rand)
RTM_EXPORT(memset)
#ifdef RT_USING_NEWLIB #ifdef RT_USING_NEWLIB