elf-defs.c (1474B)
1 #include <libelf.h> 2 #include "elf-defs.h" 3 4 const char *elf_decode_e_type(int e_type) 5 { 6 return "(unknown)"; 7 } 8 9 const char *elf_decode_sh_type(int sh_type) 10 { 11 return "(unknown)"; 12 } 13 14 const char *elf_decode_p_type(int p_type) 15 { 16 return "(unknown)"; 17 } 18 19 const char *elf_decode_st_bind(int st_bind) 20 { 21 switch (st_bind) { 22 #define STB(name) case STB_##name: return #name 23 STB(LOCAL); 24 STB(GLOBAL); 25 STB(WEAK); 26 STB(NUM); 27 #undef STB 28 } 29 if (st_bind >= STB_LOOS && st_bind <= STB_HIOS) 30 return "(OS-specific)"; 31 if (st_bind >= STB_LOPROC && st_bind <= STB_HIPROC) 32 return "(Processor-specific)"; 33 return "(unknown)"; 34 } 35 36 const char *elf_decode_st_type(int st_type) 37 { 38 switch (st_type) { 39 #define STT(name) case STT_##name: return #name 40 STT(NOTYPE); 41 STT(OBJECT); 42 STT(FUNC); 43 STT(SECTION); 44 STT(FILE); 45 STT(COMMON); 46 STT(TLS); 47 STT(NUM); 48 #undef STT 49 } 50 if (st_type >= STT_LOOS && st_type <= STT_HIOS) 51 return "(OS-specific)"; 52 if (st_type >= STT_LOPROC && st_type <= STT_HIPROC) 53 return "(Processor-specific)"; 54 return "(unknown)"; 55 } 56 57 const char *elf_decode_r_type(int r_type) 58 { 59 switch(r_type) { 60 #define R_ARM(type) case R_ARM_##type: return "R_ARM_" #type 61 R_ARM(NONE); 62 R_ARM(V4BX); 63 R_ARM(ABS32); 64 R_ARM(REL32); 65 R_ARM(THM_CALL); 66 R_ARM(CALL); 67 R_ARM(JUMP24); 68 R_ARM(TARGET1); 69 R_ARM(TARGET2); 70 R_ARM(PREL31); 71 R_ARM(MOVW_ABS_NC); 72 R_ARM(MOVT_ABS); 73 R_ARM(THM_MOVW_ABS_NC); 74 R_ARM(THM_MOVT_ABS); 75 #undef R_ARM 76 } 77 78 return "<<INVALID RELOCATION>>"; 79 } 80 81