readelf.c
来自「基于4个mips核的noc设计」· C语言 代码 · 共 2,305 行 · 第 1/5 页
C
2,305 行
} break; case EF_ARM_EABI_UNKNOWN: while (e_flags) { unsigned flag; /* Process flags one bit at a time. */ flag = e_flags & - e_flags; e_flags &= ~ flag; switch (flag) { case EF_INTERWORK: strcat (buf, ", interworking enabled"); break; case EF_APCS_26: strcat (buf, ", uses APCS/26"); break; case EF_APCS_FLOAT: strcat (buf, ", uses APCS/float"); break; case EF_PIC: strcat (buf, ", position independent"); break; case EF_ALIGN8: strcat (buf, ", 8 bit structure alignment"); break; case EF_NEW_ABI: strcat (buf, ", uses new ABI"); break; case EF_OLD_ABI: strcat (buf, ", uses old ABI"); break; case EF_SOFT_FLOAT: strcat (buf, ", software FP"); break; default: unknown = 1; break; } } } if (unknown) strcat (buf,", <unknown>");}static char *get_machine_flags (e_flags, e_machine) unsigned e_flags; unsigned e_machine;{ static char buf [1024]; buf[0] = '\0'; if (e_flags) { switch (e_machine) { default: break; case EM_ARM: decode_ARM_machine_flags (e_flags, buf); break; case EM_68K: if (e_flags & EF_CPU32) strcat (buf, ", cpu32"); break; case EM_PPC: if (e_flags & EF_PPC_EMB) strcat (buf, ", emb"); if (e_flags & EF_PPC_RELOCATABLE) strcat (buf, ", relocatable"); if (e_flags & EF_PPC_RELOCATABLE_LIB) strcat (buf, ", relocatable-lib"); break; case EM_CYGNUS_V850: switch (e_flags & EF_V850_ARCH) { case E_V850E_ARCH: strcat (buf, ", v850e"); break; case E_V850EA_ARCH: strcat (buf, ", v850ea"); break; case E_V850_ARCH: strcat (buf, ", v850"); break; default: strcat (buf, ", unknown v850 architecture variant"); break; } break; case EM_CYGNUS_M32R: if ((e_flags & EF_M32R_ARCH) == E_M32R_ARCH) strcat (buf, ", m32r"); break; case EM_MIPS: case EM_MIPS_RS3_LE: if (e_flags & EF_MIPS_NOREORDER) strcat (buf, ", noreorder"); if (e_flags & EF_MIPS_PIC) strcat (buf, ", pic"); if (e_flags & EF_MIPS_CPIC) strcat (buf, ", cpic"); if (e_flags & EF_MIPS_ABI2) strcat (buf, ", abi2"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1) strcat (buf, ", mips1"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2) strcat (buf, ", mips2"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3) strcat (buf, ", mips3"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) strcat (buf, ", mips4"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5) strcat (buf, ", mips5"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32) strcat (buf, ", mips32"); if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64) strcat (buf, ", mips64"); switch ((e_flags & EF_MIPS_MACH)) { case E_MIPS_MACH_3900: strcat (buf, ", 3900"); break; case E_MIPS_MACH_4010: strcat (buf, ", 4010"); break; case E_MIPS_MACH_4100: strcat (buf, ", 4100"); break; case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break; case E_MIPS_MACH_4111: strcat (buf, ", 4111"); break; case E_MIPS_MACH_MIPS32_4K: strcat (buf, ", mips32-4k"); break; case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break; default: strcat (buf, " UNKNOWN"); break; } break; case EM_SPARCV9: if (e_flags & EF_SPARC_32PLUS) strcat (buf, ", v8+"); if (e_flags & EF_SPARC_SUN_US1) strcat (buf, ", ultrasparcI"); if (e_flags & EF_SPARC_SUN_US3) strcat (buf, ", ultrasparcIII"); if (e_flags & EF_SPARC_HAL_R1) strcat (buf, ", halr1"); if (e_flags & EF_SPARC_LEDATA) strcat (buf, ", ledata"); if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_TSO) strcat (buf, ", tso"); if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_PSO) strcat (buf, ", pso"); if ((e_flags & EF_SPARCV9_MM) == EF_SPARCV9_RMO) strcat (buf, ", rmo"); break; case EM_PARISC: switch (e_flags & EF_PARISC_ARCH) { case EFA_PARISC_1_0: strcpy (buf, ", PA-RISC 1.0"); break; case EFA_PARISC_1_1: strcpy (buf, ", PA-RISC 1.1"); break; case EFA_PARISC_2_0: strcpy (buf, ", PA-RISC 2.0"); break; default: break; } if (e_flags & EF_PARISC_TRAPNIL) strcat (buf, ", trapnil"); if (e_flags & EF_PARISC_EXT) strcat (buf, ", ext"); if (e_flags & EF_PARISC_LSB) strcat (buf, ", lsb"); if (e_flags & EF_PARISC_WIDE) strcat (buf, ", wide"); if (e_flags & EF_PARISC_NO_KABP) strcat (buf, ", no kabp"); if (e_flags & EF_PARISC_LAZYSWAP) strcat (buf, ", lazyswap"); break; case EM_PJ: if ((e_flags & EF_PICOJAVA_NEWCALLS) == EF_PICOJAVA_NEWCALLS) strcat (buf, ", new calling convention"); if ((e_flags & EF_PICOJAVA_GNUCALLS) == EF_PICOJAVA_GNUCALLS) strcat (buf, ", gnu calling convention"); break; case EM_IA_64: if ((e_flags & EF_IA_64_ABI64)) strcat (buf, ", 64-bit"); else strcat (buf, ", 32-bit"); if ((e_flags & EF_IA_64_REDUCEDFP)) strcat (buf, ", reduced fp model"); if ((e_flags & EF_IA_64_NOFUNCDESC_CONS_GP)) strcat (buf, ", no function descriptors, constant gp"); else if ((e_flags & EF_IA_64_CONS_GP)) strcat (buf, ", constant gp"); if ((e_flags & EF_IA_64_ABSOLUTE)) strcat (buf, ", absolute"); break; } } return buf;}static const char *get_mips_segment_type (type) unsigned long type;{ switch (type) { case PT_MIPS_REGINFO: return "REGINFO"; case PT_MIPS_RTPROC: return "RTPROC"; case PT_MIPS_OPTIONS: return "OPTIONS"; default: break; } return NULL;}static const char *get_parisc_segment_type (type) unsigned long type;{ switch (type) { case PT_HP_TLS: return "HP_TLS"; case PT_HP_CORE_NONE: return "HP_CORE_NONE"; case PT_HP_CORE_VERSION: return "HP_CORE_VERSION"; case PT_HP_CORE_KERNEL: return "HP_CORE_KERNEL"; case PT_HP_CORE_COMM: return "HP_CORE_COMM"; case PT_HP_CORE_PROC: return "HP_CORE_PROC"; case PT_HP_CORE_LOADABLE: return "HP_CORE_LOADABLE"; case PT_HP_CORE_STACK: return "HP_CORE_STACK"; case PT_HP_CORE_SHM: return "HP_CORE_SHM"; case PT_HP_CORE_MMF: return "HP_CORE_MMF"; case PT_HP_PARALLEL: return "HP_PARALLEL"; case PT_HP_FASTBIND: return "HP_FASTBIND"; case PT_PARISC_ARCHEXT: return "PARISC_ARCHEXT"; case PT_PARISC_UNWIND: return "PARISC_UNWIND"; default: break; } return NULL;}static const char *get_ia64_segment_type (type) unsigned long type;{ switch (type) { case PT_IA_64_ARCHEXT: return "IA_64_ARCHEXT"; case PT_IA_64_UNWIND: return "IA_64_UNWIND"; default: break; } return NULL;}static const char *get_segment_type (p_type) unsigned long p_type;{ static char buff [32]; switch (p_type) { case PT_NULL: return "NULL"; case PT_LOAD: return "LOAD"; case PT_DYNAMIC: return "DYNAMIC"; case PT_INTERP: return "INTERP"; case PT_NOTE: return "NOTE"; case PT_SHLIB: return "SHLIB"; case PT_PHDR: return "PHDR"; default: if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC)) { const char * result; switch (elf_header.e_machine) { case EM_MIPS: case EM_MIPS_RS3_LE: result = get_mips_segment_type (p_type); break; case EM_PARISC: result = get_parisc_segment_type (p_type); break; case EM_IA_64: result = get_ia64_segment_type (p_type); break; default: result = NULL; break; } if (result != NULL) return result; sprintf (buff, "LOPROC+%lx", p_type - PT_LOPROC); } else if ((p_type >= PT_LOOS) && (p_type <= PT_HIOS)) { const char * result; switch (elf_header.e_machine) { case EM_PARISC: result = get_parisc_segment_type (p_type); break; default: result = NULL; break; } if (result != NULL) return result; sprintf (buff, "LOOS+%lx", p_type - PT_LOOS); } else sprintf (buff, _("<unknown>: %lx"), p_type); return buff; }}static const char *get_mips_section_type_name (sh_type) unsigned int sh_type;{ switch (sh_type) { case SHT_MIPS_LIBLIST: return "MIPS_LIBLIST"; case SHT_MIPS_MSYM: return "MIPS_MSYM"; case SHT_MIPS_CONFLICT: return "MIPS_CONFLICT"; case SHT_MIPS_GPTAB: return "MIPS_GPTAB"; case SHT_MIPS_UCODE: return "MIPS_UCODE"; case SHT_MIPS_DEBUG: return "MIPS_DEBUG"; case SHT_MIPS_REGINFO: return "MIPS_REGINFO"; case SHT_MIPS_PACKAGE: return "MIPS_PACKAGE"; case SHT_MIPS_PACKSYM: return "MIPS_PACKSYM"; case SHT_MIPS_RELD: return "MIPS_RELD"; case SHT_MIPS_IFACE: return "MIPS_IFACE"; case SHT_MIPS_CONTENT: return "MIPS_CONTENT"; case SHT_MIPS_OPTIONS: return "MIPS_OPTIONS"; case SHT_MIPS_SHDR: return "MIPS_SHDR"; case SHT_MIPS_FDESC: return "MIPS_FDESC"; case SHT_MIPS_EXTSYM: return "MIPS_EXTSYM"; case SHT_MIPS_DENSE: return "MIPS_DENSE"; case SHT_MIPS_PDESC: return "MIPS_PDESC"; case SHT_MIPS_LOCSYM: return "MIPS_LOCSYM"; case SHT_MIPS_AUXSYM: return "MIPS_AUXSYM"; case SHT_MIPS_OPTSYM: return "MIPS_OPTSYM"; case SHT_MIPS_LOCSTR: return "MIPS_LOCSTR"; case SHT_MIPS_LINE: return "MIPS_LINE"; case SHT_MIPS_RFDESC: return "MIPS_RFDESC"; case SHT_MIPS_DELTASYM: return "MIPS_DELTASYM"; case SHT_MIPS_DELTAINST: return "MIPS_DELTAINST"; case SHT_MIPS_DELTACLASS: return "MIPS_DELTACLASS"; case SHT_MIPS_DWARF: return "MIPS_DWARF"; case SHT_MIPS_DELTADECL: return "MIPS_DELTADECL"; case SHT_MIPS_SYMBOL_LIB: return "MIPS_SYMBOL_LIB"; case SHT_MIPS_EVENTS: return "MIPS_EVENTS"; case SHT_MIPS_TRANSLATE: return "MIPS_TRANSLATE"; case SHT_MIPS_PIXIE: return "MIPS_PIXIE"; case SHT_MIPS_XLATE: return "MIPS_XLATE"; case SHT_MIPS_XLATE_DEBUG: return "MIPS_XLATE_DEBUG"; case SHT_MIPS_WHIRL: return "MIPS_WHIRL"; case SHT_MIPS_EH_REGION: return "MIPS_EH_REGION"; case SHT_MIPS_XLATE_OLD: return "MIPS_XLATE_OLD"; case SHT_MIPS_PDR_EXCEPTION: return "MIPS_PDR_EXCEPTION"; default: break; } return NULL;}static const char *get_parisc_section_type_name (sh_type) unsigned int sh_type;{ switch (sh_type) { case SHT_PARISC_EXT: return "PARISC_EXT"; case SHT_PARISC_UNWIND: return "PARISC_UNWIND"; case SHT_PARISC_DOC: return "PARISC_DOC"; default: break; } return NULL;}static const char *get_ia64_section_type_name (sh_type) unsigned int sh_type;{ switch (sh_type) { case SHT_IA_64_EXT: return "IA_64_EXT"; case SHT_IA_64_UNWIND: return "IA_64_UNWIND"; default: break; } return NULL;}static const char *get_section_type_name (sh_type) unsigned int sh_type;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?