⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elf.h

📁 eCos/RedBoot for勤研ARM AnywhereII(4510) 含全部源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#define EM_SH                   42      // Hitachi SH
#define EM_SPARCV9              43      // SPARC Version 9
#define EM_TRICORE              44      // Siemens Tricore embedded processor
#define EM_ARC                  45      // Argonaut RISC Core, Argonaut Technologies Inc.
#define EM_H8_300               46      // Hitachi H8/300
#define EM_H8_300H              47      // Hitachi H8/300H
#define EM_H8S                  48      // Hitachi H8S
#define EM_H8_500               49      // Hitachi H8/500
#define EM_IA_64                50      // Intel IA-64 processor architecture
#define EM_MIPS_X               51      // Stanford MIPS-X
#define EM_COLDFIRE             52      // Motorola ColdFire
#define EM_68HC12               53      // Motorola M68HC12
#define EM_MMA                  54      // Fujitsu MMA Multimedia Accelerator
#define EM_PCP                  55      // Siemens PCP
#define EM_NCPU                 56      // Sony nCPU embedded RISC processor
#define EM_NDR1                 57      // Denso NDR1 microprocessor
#define EM_STARCORE             58      // Motorola Star*Core processor
#define EM_ME16                 59      // Toyota ME16 processor
#define EM_ST100                60      // STMicroelectronics ST100 processor
#define EM_TINYJ                61      // Advanced Logic Corp. TinyJ embedded processor family
#define EM_FX66                 66      // Siemens FX66 microcontroller
#define EM_ST9PLUS              67      // STMicroelectronics ST9+ 8/16 bit microcontroller
#define EM_ST7                  68      // STMicroelectronics ST7 8-bit microcontroller
#define EM_68HC16               69      // Motorola MC68HC16 Microcontroller
#define EM_68HC11               70      // Motorola MC68HC11 Microcontroller
#define EM_68HC08               71      // Motorola MC68HC08 Microcontroller
#define EM_68HC05               72      // Motorola MC68HC05 Microcontroller
#define EM_SVX                  73      // Silicon Graphics SVx
#define EM_ST19                 74      // STMicroelectronics ST19 8-bit microcontroller
#define EM_VAX                  75      // Digital VAX
#define EM_CRIS                 76      // Axis Communications 32-bit embedded processor
#define EM_JAVELIN              77      // Infineon Technologies 32-bit embedded processor
#define EM_FIREPATH             78      // Element 14 64-bit DSP Processor
#define EM_ZSP                  79      // LSI Logic 16-bit DSP Processor
#define EM_MMIX                 80      // Donald Knuth's educational 64-bit processor
#define EM_HUANY                81      // Harvard University machine-independent object files
#define EM_PRISM                82      // SiTera Prism

/* Cygnus PowerPC ELF backend.  Written in the absence of an ABI.  */
#define EM_CYGNUS_POWERPC 0x9025

/* Old version of Sparc v9, from before the ABI; this should be
   removed shortly.  */
#define EM_OLD_SPARCV9  11

/* Old version of PowerPC, this should be removed shortly. */
#define EM_PPC_OLD      17

/* Cygnus ARC ELF backend.  Written in the absence of an ABI.  */
#define EM_CYGNUS_ARC 0x9040

/* Cygnus M32R ELF backend.  Written in the absence of an ABI.  */
#define EM_CYGNUS_M32R 0x9041

/* Alpha backend magic number.  Written in the absence of an ABI.  */
//#define EM_ALPHA        0x9026

/* D10V backend magic number.  Written in the absence of an ABI.  */
#define EM_CYGNUS_D10V  0x7650

/* D30V backend magic number.  Written in the absence of an ABI.  */
#define EM_CYGNUS_D30V  0x7676

/* V850 backend magic number.  Written in the absense of an ABI.  */
#define EM_CYGNUS_V850  0x9080

/* mn10200 and mn10300 backend magic numbers.
   Written in the absense of an ABI.  */
#define EM_CYGNUS_MN10200       0xdead
#define EM_CYGNUS_MN10300       0xbeef

/* FR30 magic number - no EABI available.  */
#define EM_CYGNUS_FR30          0x3330

/* AVR magic number
   Written in the absense of an ABI.  */
#define EM_AVR                  0x1057

// -------------------------------------------------------------------------
/* Version */

#define EV_NONE         0               /* Invalid */
#define EV_CURRENT      1               /* Current */
#define EV_NUM          2               /* number of versions */

// -------------------------------------------------------------------------
/* Section Header */

typedef struct {
    Elf32_Word  sh_name;        /* name - index into section header
                                   string table section */
    Elf32_Word  sh_type;        /* type */
    Elf32_Word  sh_flags;       /* flags */
    Elf32_Addr  sh_addr;        /* address */
    Elf32_Off   sh_offset;      /* file offset */
    Elf32_Word  sh_size;        /* section size */
    Elf32_Word  sh_link;        /* section header table index link */
    Elf32_Word  sh_info;        /* extra information */
    Elf32_Word  sh_addralign;   /* address alignment */
    Elf32_Word  sh_entsize;     /* section entry size */
} Elf32_Shdr;

typedef struct {
    Elf64_Word  sh_name;        /* section name */
    Elf64_Word  sh_type;        /* section type */
    Elf64_Xword sh_flags;       /* section flags */
    Elf64_Addr  sh_addr;        /* virtual address */
    Elf64_Off   sh_offset;      /* file offset */
    Elf64_Xword sh_size;        /* section size */
    Elf64_Word  sh_link;        /* link to another */
    Elf64_Word  sh_info;        /* misc info */
    Elf64_Xword sh_addralign;   /* memory alignment */
    Elf64_Xword sh_entsize;     /* table entry size */
} Elf64_Shdr;

// -------------------------------------------------------------------------
/* Special Section Indexes */

#define SHN_UNDEF       0               /* undefined */
#define SHN_LORESERVE   0xff00          /* lower bounds of reserved indexes */
#define SHN_LOPROC      0xff00          /* reserved range for processor */
#define SHN_HIPROC      0xff1f          /*   specific section indexes */
#define SHN_LOOS        0xff20          /* reserved range for operating */
#define SHN_HIOS        0xff3f          /*   system specific section indexes */
#define SHN_ABS         0xfff1          /* absolute value */
#define SHN_COMMON      0xfff2          /* common symbol */
#define SHN_XINDEX      0xffff          /* escape value for oversize index */
#define SHN_HIRESERVE   0xffff          /* upper bounds of reserved indexes */

// -------------------------------------------------------------------------
/* sh_type */

#define SHT_NULL        0               /* inactive */
#define SHT_PROGBITS    1               /* program defined information */
#define SHT_SYMTAB      2               /* symbol table section */
#define SHT_STRTAB      3               /* string table section */
#define SHT_RELA        4               /* relocation section with addends*/
#define SHT_HASH        5               /* symbol hash table section */
#define SHT_DYNAMIC     6               /* dynamic section */
#define SHT_NOTE        7               /* note section */
#define SHT_NOBITS      8               /* no space section */
#define SHT_REL         9               /* relation section without addends */
#define SHT_SHLIB       10              /* reserved - purpose unknown */
#define SHT_DYNSYM      11              /* dynamic symbol table section */
#define SHT_INIT_ARRAY  14              /* init procedure array */
#define SHT_FINI_ARRAY  15              /* fini procedure array */
#define SHT_PREINIT_ARRAY 16            /* preinit procedure array */
#define SHT_GROUP       17              /* section group */
#define SHT_SYMTAB_SHNDX 18             /* oversize index table */
#define SHT_NUM         19              /* number of section types */
#define SHT_LOOS        0x60000000      /* reserved range for O/S */
#define SHT_HIOS        0x6fffffff      /*  specific section header types */
#define SHT_LOPROC      0x70000000      /* reserved range for processor */
#define SHT_HIPROC      0x7fffffff      /*  specific section header types */
#define SHT_LOUSER      0x80000000      /* reserved range for application */
#define SHT_HIUSER      0xffffffff      /*  specific indexes */

// -------------------------------------------------------------------------
/* Section names */

#define ELF_BSS         ".bss"          /* uninitialized data */
#define ELF_DATA        ".data"         /* initialized data */
#define ELF_DEBUG       ".debug"        /* debug */
#define ELF_DYNAMIC     ".dynamic"      /* dynamic linking information */
#define ELF_DYNSTR      ".dynstr"       /* dynamic string table */
#define ELF_DYNSYM      ".dynsym"       /* dynamic symbol table */
#define ELF_FINI        ".fini"         /* termination code */
#define ELF_GOT         ".got"          /* global offset table */
#define ELF_HASH        ".hash"         /* symbol hash table */
#define ELF_INIT        ".init"         /* initialization code */
#define ELF_REL_DATA    ".rel.data"     /* relocation data */
#define ELF_REL_FINI    ".rel.fini"     /* relocation termination code */
#define ELF_REL_INIT    ".rel.init"     /* relocation initialization code */
#define ELF_REL_DYN     ".rel.dyn"      /* relocaltion dynamic link info */
#define ELF_REL_RODATA  ".rel.rodata"   /* relocation read-only data */
#define ELF_REL_TEXT    ".rel.text"     /* relocation code */
#define ELF_RODATA      ".rodata"       /* read-only data */
#define ELF_SHSTRTAB    ".shstrtab"     /* section header string table */
#define ELF_STRTAB      ".strtab"       /* string table */
#define ELF_SYMTAB      ".symtab"       /* symbol table */
#define ELF_TEXT        ".text"         /* code */

// -------------------------------------------------------------------------
/* Section Attribute Flags - sh_flags */

#define SHF_WRITE               0x001           /* Writable */
#define SHF_ALLOC               0x002           /* occupies memory */
#define SHF_EXECINSTR           0x004           /* executable */
#define SHF_MERGE               0x010           /* merge data */
#define SHF_STRINGS             0x020           /* contains strings */
#define SHF_INFO_LINK           0x040           /* link in sh_info field */
#define SHF_LINK_ORDER          0x080           /* preserve link order */
#define SHF_OS_NONCONFORMING    0x100           /* special OS-specific */
                                                /*  processing needed */
#define SHF_GROUP               0x200           /* member of group */
#define SHF_MASKOS              0x0ff00000      /* reserved bits for OS */
                                                /*  specific section attributes */
#define SHF_MASKPROC            0xf0000000      /* reserved bits for processor */
                                                /*  specific section attributes */

// -------------------------------------------------------------------------
/* Symbol Table Entry */

typedef struct {
    Elf32_Word          st_name;        /* name - index into string table */
    Elf32_Addr          st_value;       /* symbol value */
    Elf32_Word          st_size;        /* symbol size */
    unsigned char       st_info;        /* type and binding */
    unsigned char       st_other;       /* visibility */
    Elf32_Half          st_shndx;       /* section header index */
} Elf32_Sym;

typedef struct {
    Elf64_Word          st_name;        /* Symbol name index in str table */
    unsigned char       st_info;        /* type / binding attrs */
    unsigned char       st_other;       /* visibility */
    Elf64_Half          st_shndx;       /* section index of symbol */
    Elf64_Addr          st_value;       /* value of symbol */
    Elf64_Xword          st_size;        /* size of symbol */
} Elf64_Sym;

// -------------------------------------------------------------------------
/* Symbol table index */

#define STN_UNDEF       0               /* undefined */

/* Extract symbol info - st_info */
#define ELF32_ST_BIND(x)        ((x) >> 4)
#define ELF32_ST_TYPE(x)        (((unsigned int) x) & 0xf)
#define ELF32_ST_INFO(b,t)      (((b) << 4) + ((t) & 0xf))

#define ELF64_ST_BIND(x)        ((x) >> 4)
#define ELF64_ST_TYPE(x)        (((unsigned int) x) & 0xf)
#define ELF64_ST_INFO(b,t)      (((b) << 4) + ((t) & 0xf))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -