reloc_arm.c (872B)
1 /* arm (32-bit) relocation handler for the static linker */ 2 3 #include "ld_arch.h" 4 5 void 6 ld_arm_reloc_apply(struct ld_reloc *r) 7 { 8 switch (r->type) { 9 case R_ARM_NONE: 10 break; 11 case R_ARM_ABS16: 12 *(unsigned short *)r->dst += r->val; 13 break; 14 case R_ARM_ABS32: 15 *(unsigned int *)r->dst += r->val; 16 break; 17 case R_ARM_REL32: 18 case R_ARM_PLT32: 19 *(unsigned int *)r->dst += r->val - r->addr; 20 break; 21 case R_ARM_PC24: 22 *r->dst = (*r->dst & 0xff000000) | ((*r->dst + ((r->val - r->addr) >> 2)) & 0x00ffffff); 23 break; 24 default: 25 die("ld: unknown arm relocation type"); 26 } 27 } 28 29 static int 30 ld_arm_is_got_rel(unsigned int type) 31 { 32 (void)type; 33 return 0; 34 } 35 36 const struct ld_arch_backend ld_arch_arm = { 37 .em_machine = EM_ARM, 38 .reloc_apply = ld_arm_reloc_apply, 39 .is_got_rel = ld_arm_is_got_rel, 40 };