reloc_x86.c (735B)
1 /* x86 (i386) relocation handler for the static linker */ 2 3 #include "ld_arch.h" 4 5 void 6 ld_x86_reloc_apply(struct ld_reloc *r) 7 { 8 switch (r->type) { 9 case R_386_NONE: 10 break; 11 case R_386_16: 12 *(unsigned short *)r->dst += r->val; 13 break; 14 case R_386_32: 15 *(unsigned int *)r->dst += r->val; 16 break; 17 case R_386_PC32: 18 case R_386_PLT32: 19 *(unsigned int *)r->dst += r->val - r->addr; 20 break; 21 default: 22 die("ld: unknown i386 relocation type"); 23 } 24 } 25 26 static int 27 ld_x86_is_got_rel(unsigned int type) 28 { 29 (void)type; 30 return 0; 31 } 32 33 const struct ld_arch_backend ld_arch_x86 = { 34 .em_machine = EM_386, 35 .reloc_apply = ld_x86_reloc_apply, 36 .is_got_rel = ld_x86_is_got_rel, 37 };