Linux加载ko出现unknown relocation: 38 的解决办法
2015-03-16 16:15
225 查看
Kernel module build with GCOV profiling fails to load with the following error: $ insmod test_module.ko test_module: unknown relocation: 38 insmod: can't insert 'test_module.ko': invalid module format This happens because constructor pointers in the .init_array section have not supported R_ARM_TARGET1 relocation type. Documentation (ELF for the ARM Architecture) says: "The relocation must be processed either in the same way as R_ARM_REL32 or as R_ARM_ABS32: a virtual platform must specify which method is used." Since kernel expects to see absolute addresses in .init_array R_ARM_TARGET1 relocation type should be treated the same way as R_ARM_ABS32. Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com> --- arch/arm/include/asm/elf.h | 1 + arch/arm/kernel/module.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index f4b46d3..afb9caf 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t; #define R_ARM_ABS32 2 #define R_ARM_CALL 28 #define R_ARM_JUMP24 29 +#define R_ARM_TARGET1 38 #define R_ARM_V4BX 40 #define R_ARM_PREL31 42 #define R_ARM_MOVW_ABS_NC 43 diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 45e4781..6a4dffe 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -91,6 +91,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, break; case R_ARM_ABS32: + case R_ARM_TARGET1: *(u32 *)loc += sym->st_value; break; -- 1.8.5.5
相关文章推荐
- Visual Studio 2008不能创建数据库连接出现:未能加载文件或程序集“Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral,PublicKeyToken=89845dcd8080cc91”或它的一个依赖项。系统找不到指定的文件的解决办法
- 删除/维护 VS2008时出现:“加载安装组件时遇到问题。”的解决办法
- CB 或DELPHI出现无法加载dclite50.bpl的解决办法
- VS2008序列号/注册码/删除/维护 VS2008时出现:“加载安装组件时遇到问题。”的解决办法
- Visual Studio 2008不能创建数据库连接出现:未能加载文件或程序集“Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral,PublicKeyToken=89845dcd8080cc91”或它的一个依赖项。系统找不到指定的文件的解决办法
- Asp.net 2.0 页面出现“未能加载视图状态...”错误的解决办法(作者:海雅)
- Fedora9.0和VMware6.5下编译内核出现arm-linux-gcc无法找到的错误解决办法
- 用oralce连接.net客户端出现问题:“数据连接不成功,请检查该数据库是否已启动尝试加载oracle客户端时引发BadImageFormatException.如果在安装32位Oracle客户端组件的情况下以64位模式运行,”的解决办法
- linux下安装kscope1.9.4.tar.gz出现的错误解决办法
- 安装Oracle时出现加载areaqueries数据库失败的错误的解决办法
- 在windowsxp系统内删除linux系统分区后出现grub error 22系统无法启动的解决办法
- LINUX驱动学习:加载模块时出现Device or resource busy的解决方法
- Linux 2.6.x 内核模块加载错误 “Invalid module format” 解决办法
- 安装Oracle时出现加载areaqueries数据库失败的错误的解决办法
- Linux 2.6.x 内核模块加载错误 “Invalid module format” 解决办法
- 关于linux做nat出现“table full”的终极解决办法。
- 安装Oracle9i出现:加载数据库时出错:areasQueries错误的解决办法
- UNIX/Linux下运行脚本文件出现bad interpreter:No such file or directory的原因和解决办法
- Qt在linux下调用phonon出现的问题解决办法
- VMware下Linux安装VMWare Tools 后无法启动图形界面,出现"no screens found" 的解决办法