zoukankan      html  css  js  c++  java
  • [内核补丁] 解决2.6.29内核上加载模块出现"unknown relocation: 40"

    我使用s3c2410+linux2.6.25.20+arm-linux-gcc4.3.3(使用过其它较低版本3.4.5则不会出现这个问题)加载fat.ko等fat文件系统模块时候会报错,并不是全部都报错,某些简单的如led.ko不会。

    http://www.arm9home.net/read.php?tid-1708.html

    从上网站中获取补丁,补丁内容如下,按照修改内核问题解决:

    # Author:    Daniel Silverstone (Fri Mar 20 10:11:43 GMT 2009)
    # Committer: Russell King (Sat Mar 21 11:22:33 GMT 2009)
    #
    #   [ARM] 5428/1: Module relocation update for R_ARM_V4BX
    #
    #   It would seem when building kernel modules with modern binutils
    #   (required by modern GCC) for ARM v4T targets (specifically observed
    #   with the Samsung 24xx SoC which is an 920T) R_ARM_V4BX relocations
    #   are emitted for function epilogues.
    #
    #   This manifests at module load time with an "unknown relocation: 40"
    #   error message.
    #
    #   The following patch adds the R_ARM_V4BX relocation to the ARM kernel
    #   module loader. The relocation operation is taken from that within the
    #   binutils bfd library.
    #
    #   Signed-off-by: Simtec Linux Team
    #   Signed-off-by: Vincent Sanders
    #   Signed-off-by: Russell King
    #
    #    arch/arm/include/asm/elf.h |    1 +
    #    arch/arm/kernel/module.c   |    9 +++++++++
    #    2 files changed, 10 insertions(+), 0 deletions(-)
    diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
    index a58378c..ce3b36e 100644
    --- a/arch/arm/include/asm/elf.h
    +++ b/arch/arm/include/asm/elf.h     //我修改的是 include/asm-arm/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_V4BX    40
    /*
      * These are used to set parameters in the core dumps.
    diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
    index dab48f2..9f509fd 100644
    --- a/arch/arm/kernel/module.c
    +++ b/arch/arm/kernel/module.c
    @@ -132,6 +132,15 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
                 *(u32 *)loc |= offset & 0x00ffffff;
                 break;
    +           case R_ARM_V4BX:
    +               /* Preserve Rm and the condition code. Alter
    +            * other bits to re-code instruction as
    +            * MOV PC,Rm.
    +            */
    +               *(u32 *)loc &= 0xf000000f;
    +               *(u32 *)loc |= 0x01a0f000;
    +               break;
    +
             default:
                 printk(KERN_ERR "%s: unknown relocation: %u\n",
                        module->name, ELF32_R_TYPE(rel->r_info));

  • 相关阅读:
    LTE-TDD随机接入过程(3)-RAR(MSG2)以及MSG1的重传
    《javascript设计模式》读书笔记一(接口)
    数据结构——算法之(033)(两个有序单链表合并为一个有序的单链表)
    利用redis和php-resque实现后台任务
    最能毁掉程序猿健康的几件事
    springMVC4(11)使用注解完毕数据格式化
    Linux
    Linux
    Linux
    Fluent_Python_Part4面向对象,11-iface-abc,协议(接口),抽象基类
  • 原文地址:https://www.cnblogs.com/leaven/p/1828254.html
Copyright © 2011-2022 走看看