add the R_ARM_V4BX relocation to the ARM kernel module loader
[openwrt/staging/dedeckeh.git] / target / linux / generic-2.6 / patches-2.6.28 / 230-add-r_arm_v4bx-relocation-for-arm-module-loader.patch
1 diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
2 index a58378c..ce3b36e 100644
3 --- a/arch/arm/include/asm/elf.h
4 +++ b/arch/arm/include/asm/elf.h
5 @@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t;
6 #define R_ARM_ABS32 2
7 #define R_ARM_CALL 28
8 #define R_ARM_JUMP24 29
9 +#define R_ARM_V4BX 40
10
11 /*
12 * These are used to set parameters in the core dumps.
13 diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
14 index dab48f2..9f509fd 100644
15 --- a/arch/arm/kernel/module.c
16 +++ b/arch/arm/kernel/module.c
17 @@ -132,6 +132,15 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
18 *(u32 *)loc |= offset & 0x00ffffff;
19 break;
20
21 + case R_ARM_V4BX:
22 + /* Preserve Rm and the condition code. Alter
23 + * other bits to re-code instruction as
24 + * MOV PC,Rm.
25 + */
26 + *(u32 *)loc &= 0xf000000f;
27 + *(u32 *)loc |= 0x01a0f000;
28 + break;
29 +
30 default:
31 printk(KERN_ERR "%s: unknown relocation: %u\n",
32 module->name, ELF32_R_TYPE(rel->r_info));
33