ARC: module: support R_ARC_32_PCREL relocation
authorVineet Gupta <vgupta@synopsys.com>
Mon, 12 Sep 2016 23:50:50 +0000 (16:50 -0700)
committerVineet Gupta <vgupta@synopsys.com>
Fri, 30 Sep 2016 21:48:19 +0000 (14:48 -0700)
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/include/asm/elf.h
arch/arc/kernel/module.c

index 51a99e25fe338251b23fe00bf2b1849b6a7252a2..7096f97a14340f5d54766e21245c7ae779da0e72 100644 (file)
@@ -23,8 +23,7 @@
 /* ARC Relocations (kernel Modules only) */
 #define  R_ARC_32              0x4
 #define  R_ARC_32_ME           0x1B
-#define  R_ARC_S25H_PCREL      0x10
-#define  R_ARC_S25W_PCREL      0x11
+#define  R_ARC_32_PCREL                0x31
 
 /*to set parameters in the core dumps */
 #define ELF_ARCH               EM_ARCOMPACT
index 376e04622962b37917dd8681a9ce9e0cb7d0224a..576a238434a141d552af52bd6d4f730cb8e5b4a8 100644 (file)
@@ -106,10 +106,12 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
                 */
                relo_type = ELF32_R_TYPE(rel_entry[i].r_info);
 
-               if (likely(R_ARC_32_ME == relo_type))
+               if (likely(R_ARC_32_ME == relo_type))   /* ME ( S + A ) */
                        arc_write_me((unsigned short *)location, relocation);
-               else if (R_ARC_32 == relo_type)
+               else if (R_ARC_32 == relo_type)         /* ( S + A ) */
                        *((Elf32_Addr *) location) = relocation;
+               else if (R_ARC_32_PCREL == relo_type)   /* ( S + A ) - PDATA ) */
+                       *((Elf32_Addr *) location) = relocation - location;
                else
                        goto relo_err;