arch.c (558B)
1 /* ld arch dispatch: selects the right relocation backend at runtime 2 * based on the e_machine field of input object files */ 3 4 #include "ld_arch.h" 5 6 const struct ld_arch_backend * 7 ld_arch_select(int em_machine) 8 { 9 switch (em_machine) { 10 case EM_X86_64: 11 return &ld_arch_x64; 12 case EM_386: 13 return &ld_arch_x86; 14 case EM_ARM: 15 return &ld_arch_arm; 16 #ifdef EM_RISCV 17 case EM_RISCV: 18 return &ld_arch_riscv; 19 #endif 20 #ifdef EM_AARCH64 21 case EM_AARCH64: 22 return &ld_arch_aarch64; 23 #endif 24 default: 25 return NULL; 26 } 27 }