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