瀏覽代碼

update elf loader for R_ARM_RELATIVE type relocation

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1196 bbd45198-f89e-11dd-88c7-29a3b14d5316
qiuyiuestc 14 年之前
父節點
當前提交
b7e62fb733
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 4 2
      src/module.c
  2. 1 0
      src/module.h

+ 4 - 2
src/module.c

@@ -163,6 +163,8 @@ static int rt_module_arm_relocate(struct rt_module* module, Elf32_Rel *rel, Elf3
 		rt_kprintf("R_ARM_JUMP_SLOT: 0x%x -> 0x%x 0x%x\n", where, *where, sym_val);
 		rt_kprintf("R_ARM_JUMP_SLOT: 0x%x -> 0x%x 0x%x\n", where, *where, sym_val);
 #endif		
 #endif		
 	break;
 	break;
+	case R_ARM_RELATIVE:		
+		 break;
 	default:
 	default:
 		return -1;
 		return -1;
 	}
 	}
@@ -337,14 +339,14 @@ 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 != 0)
+				if(sym->st_shndx != SHT_NULL || ELF_ST_TYPE(sym->st_info) == STB_LOCAL )	
 				{	
 				{	
 					rt_module_arm_relocate(
 					rt_module_arm_relocate(
 						module, 
 						module, 
 						rel, 
 						rel, 
 						(Elf32_Addr)(module->module_space + sym->st_value));
 						(Elf32_Addr)(module->module_space + sym->st_value));
 				}
 				}
-				else if(linked == RT_FALSE)
+				else if(!linked)
 				{
 				{
 					Elf32_Addr addr;
 					Elf32_Addr addr;
 #ifdef RT_MODULE_DEBUG
 #ifdef RT_MODULE_DEBUG

+ 1 - 0
src/module.h

@@ -161,6 +161,7 @@ typedef struct {
 #define	R_ARM_ABS32		2
 #define	R_ARM_ABS32		2
 #define	R_ARM_GLOB_DAT	21
 #define	R_ARM_GLOB_DAT	21
 #define	R_ARM_JUMP_SLOT	22
 #define	R_ARM_JUMP_SLOT	22
+#define	R_ARM_RELATIVE	23
 #define	R_ARM_PLT32		27
 #define	R_ARM_PLT32		27
 #define	R_ARM_CALL			28
 #define	R_ARM_CALL			28
 #define	R_ARM_JUMP24		29
 #define	R_ARM_JUMP24		29