Annotation of Gnu-Mach/include/mach/exec/elf.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1995, 1994, 1993, 1992, 1991, 1990  
                      3:  * Open Software Foundation, Inc. 
                      4:  *  
                      5:  * Permission to use, copy, modify, and distribute this software and 
                      6:  * its documentation for any purpose and without fee is hereby granted, 
                      7:  * provided that the above copyright notice appears in all copies and 
                      8:  * that both the copyright notice and this permission notice appear in 
                      9:  * supporting documentation, and that the name of ("OSF") or Open Software 
                     10:  * Foundation not be used in advertising or publicity pertaining to 
                     11:  * distribution of the software without specific, written prior permission. 
                     12:  *  
                     13:  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
                     14:  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
                     15:  * FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL OSF BE LIABLE FOR ANY 
                     16:  * SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
                     17:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
                     18:  * ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING 
                     19:  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE 
                     20:  * 
                     21:  */
                     22: /*
                     23:  * OSF Research Institute MK6.1 (unencumbered) 1/31/1995
                     24:  */
                     25: #ifndef _MACH_EXEC_ELF_H_
                     26: #define _MACH_EXEC_ELF_H_
                     27: 
                     28: #include <mach/machine/exec/elf.h>
                     29: 
                     30: /* ELF Header - figure 4-3, page 4-4 */
                     31: 
                     32: #define EI_NIDENT 16
                     33: 
                     34: typedef struct {
                     35:   unsigned char                e_ident[EI_NIDENT];
                     36:   Elf32_Half           e_type;
                     37:   Elf32_Half           e_machine;
                     38:   Elf32_Word           e_version;
                     39:   Elf32_Addr           e_entry;
                     40:   Elf32_Off            e_phoff;
                     41:   Elf32_Off            e_shoff;
                     42:   Elf32_Word           e_flags;
                     43:   Elf32_Half           e_ehsize;
                     44:   Elf32_Half           e_phentsize;
                     45:   Elf32_Half           e_phnum;
                     46:   Elf32_Half           e_shentsize;
                     47:   Elf32_Half           e_shnum;
                     48:   Elf32_Half           e_shstrndx;
                     49: } Elf32_Ehdr;
                     50: 
                     51: 
                     52: /* e_ident[] identification indexes - figure 4-4, page 4-7 */
                     53:   
                     54: #define EI_MAG0                0
                     55: #define EI_MAG1                1
                     56: #define EI_MAG2                2
                     57: #define EI_MAG3                3
                     58: #define EI_CLASS       4
                     59: #define EI_DATA                5
                     60: #define EI_VERSION     6
                     61: #define EI_PAD         7
                     62: 
                     63: /* magic number - pg 4-8 */
                     64: 
                     65: #define ELFMAG0                0x7f
                     66: #define ELFMAG1                'E'
                     67: #define ELFMAG2                'L'
                     68: #define ELFMAG3                'F'
                     69: 
                     70: /* file class or capacity - page 4-8 */
                     71: 
                     72: #define ELFCLASSNONE   0
                     73: #define ELFCLASS32     1
                     74: #define ELFCLASS64     2
                     75: 
                     76: /* date encoding - page 4-9 */
                     77: 
                     78: #define ELFDATANONE    0
                     79: #define ELFDATA2LSB    1
                     80: #define ELFDATA2MSB    2
                     81: 
                     82: /* object file types - page 4-5 */
                     83: 
                     84: #define ET_NONE                0
                     85: #define ET_REL         1
                     86: #define ET_EXEC                2
                     87: #define ET_DYN         3
                     88: #define ET_CORE                4
                     89: 
                     90: #define ET_LOPROC      0xff00
                     91: #define ET_HIPROC      0xffff
                     92: 
                     93: /* architecture - page 4-5 */
                     94: 
                     95: #define EM_NONE                0
                     96: #define EM_M32         1
                     97: #define EM_SPARC       2
                     98: #define EM_386         3
                     99: #define EM_68K         4
                    100: #define EM_88K         5
                    101: #define EM_860         7
                    102: #define EM_MIPS                8
                    103: #define EM_MIPS_RS4_BE 10
                    104: #define EM_SPARC64     11
                    105: #define EM_PARISC      15
                    106: #define EM_PPC         20
                    107: 
                    108: /* version - page 4-6 */
                    109: 
                    110: #define EV_NONE                0
                    111: #define EV_CURRENT     1
                    112: 
                    113: /* special section indexes - page 4-11, figure 4-7 */
                    114: 
                    115: #define SHN_UNDEF       0
                    116: #define SHN_LORESERVE   0xff00
                    117: #define SHN_LOPROC      0xff00
                    118: #define SHN_HIPROC      0xff1f
                    119: #define SHN_ABS         0xfff1
                    120: #define SHN_COMMON      0xfff2
                    121: #define SHN_HIRESERVE   0xffff
                    122: 
                    123: /* section header - page 4-13, figure 4-8 */
                    124: 
                    125: typedef struct {
                    126:   Elf32_Word           sh_name;
                    127:   Elf32_Word           sh_type;
                    128:   Elf32_Word           sh_flags;
                    129:   Elf32_Addr           sh_addr;
                    130:   Elf32_Off            sh_offset;
                    131:   Elf32_Word           sh_size;
                    132:   Elf32_Word           sh_link;
                    133:   Elf32_Word           sh_info;
                    134:   Elf32_Word           sh_addralign;
                    135:   Elf32_Word           sh_entsize;
                    136: } Elf32_Shdr;
                    137: 
                    138: /* section types - page 4-15, figure 4-9 */
                    139: 
                    140: #define SHT_NULL       0
                    141: #define SHT_PROGBITS   1
                    142: #define SHT_SYMTAB     2
                    143: #define SHT_STRTAB     3
                    144: #define SHT_RELA       4
                    145: #define SHT_HASH       5
                    146: #define SHT_DYNAMIC    6
                    147: #define SHT_NOTE       7
                    148: #define SHT_NOBITS     8
                    149: #define SHT_REL                9
                    150: #define SHT_SHLIB      10
                    151: #define SHT_DYNSYM     11
                    152: 
                    153: #define SHT_LOPROC     0x70000000
                    154: #define SHT_HIPROC     0x7fffffff
                    155: #define SHT_LOUSER     0x80000000
                    156: #define SHT_HIUSER     0xffffffff
                    157: 
                    158: /* section attribute flags - page 4-18, figure 4-11 */
                    159: 
                    160: #define        SHF_WRITE       0x1
                    161: #define SHF_ALLOC      0x2
                    162: #define        SHF_EXECINSTR   0x4
                    163: #define SHF_MASKPROC   0xf0000000
                    164: 
                    165: /* symbol table - page 4-25, figure 4-15 */
                    166: typedef struct
                    167: {
                    168:     Elf32_Word    st_name;
                    169:     Elf32_Addr    st_value;
                    170:     Elf32_Word    st_size;
                    171:     unsigned char st_info;
                    172:     unsigned char st_other;
                    173:     Elf32_Half    st_shndx;
                    174: } Elf32_Sym;
                    175: 
                    176: /* symbol type and binding attributes - page 4-26 */
                    177: 
                    178: #define ELF32_ST_BIND(i)    ((i) >> 4)
                    179: #define ELF32_ST_TYPE(i)    ((i) & 0xf)
                    180: #define ELF32_ST_INFO(b,t)  (((b)<<4)+((t)&0xf))
                    181: 
                    182: /* symbol binding - page 4-26, figure 4-16 */
                    183: 
                    184: #define STB_LOCAL    0
                    185: #define STB_GLOBAL   1
                    186: #define STB_WEAK     2
                    187: #define STB_LOPROC  13
                    188: #define STB_HIPROC  15
                    189: 
                    190: /* symbol types - page 4-28, figure 4-17 */
                    191: 
                    192: #define STT_NOTYPE   0
                    193: #define STT_OBJECT   1
                    194: #define STT_FUNC     2
                    195: #define STT_SECTION  3
                    196: #define STT_FILE     4
                    197: #define STT_LOPROC  13
                    198: #define STT_HIPROC  15
                    199: 
                    200: 
                    201: /* relocation entries - page 4-31, figure 4-19 */
                    202: 
                    203: typedef struct
                    204: {
                    205:     Elf32_Addr r_offset;
                    206:     Elf32_Word r_info;
                    207: } Elf32_Rel;
                    208: 
                    209: typedef struct
                    210: {
                    211:     Elf32_Addr r_offset;
                    212:     Elf32_Word r_info;
                    213:     Elf32_Sword r_addend;
                    214: } Elf32_Rela;
                    215: 
                    216: /* Macros to split/combine relocation type and symbol page 4-32 */
                    217: 
                    218: #define ELF32_R_SYM(__i)       ((__i)>>8)
                    219: #define ELF32_R_TYPE(__i)      ((unsigned char) (__i))
                    220: #define ELF32_R_INFO(__s, __t) (((__s)<<8) + (unsigned char) (__t))
                    221: 
                    222: 
                    223: /* program header - page 5-2, figure 5-1 */
                    224: 
                    225: typedef struct {
                    226:   Elf32_Word           p_type;
                    227:   Elf32_Off            p_offset;
                    228:   Elf32_Addr           p_vaddr;
                    229:   Elf32_Addr           p_paddr;
                    230:   Elf32_Word           p_filesz;
                    231:   Elf32_Word           p_memsz;
                    232:   Elf32_Word           p_flags;
                    233:   Elf32_Word           p_align;
                    234: } Elf32_Phdr;
                    235: 
                    236: /* segment types - page 5-3, figure 5-2 */
                    237: 
                    238: #define PT_NULL                0
                    239: #define PT_LOAD                1
                    240: #define PT_DYNAMIC     2
                    241: #define PT_INTERP      3
                    242: #define PT_NOTE                4
                    243: #define PT_SHLIB       5
                    244: #define PT_PHDR                6
                    245: 
                    246: #define PT_LOPROC      0x70000000
                    247: #define PT_HIPROC      0x7fffffff
                    248: 
                    249: /* segment permissions - page 5-6 */
                    250: 
                    251: #define PF_X           0x1
                    252: #define PF_W           0x2
                    253: #define PF_R           0x4
                    254: #define PF_MASKPROC    0xf0000000
                    255: 
                    256: 
                    257: /* dynamic structure - page 5-15, figure 5-9 */
                    258: 
                    259: typedef struct {
                    260:        Elf32_Sword     d_tag;
                    261:        union {
                    262:            Elf32_Word  d_val;
                    263:            Elf32_Addr  d_ptr;
                    264:        } d_un;
                    265: } Elf32_Dyn;
                    266: 
                    267: /* Dynamic array tags - page 5-16, figure 5-10.  */
                    268: 
                    269: #define DT_NULL                0
                    270: #define DT_NEEDED      1
                    271: #define DT_PLTRELSZ    2
                    272: #define DT_PLTGOT      3
                    273: #define DT_HASH                4
                    274: #define DT_STRTAB      5
                    275: #define DT_SYMTAB      6
                    276: #define DT_RELA                7
                    277: #define DT_RELASZ      8
                    278: #define DT_RELAENT      9
                    279: #define DT_STRSZ       10
                    280: #define DT_SYMENT      11
                    281: #define DT_INIT                12
                    282: #define DT_FINI                13
                    283: #define DT_SONAME      14
                    284: #define DT_RPATH       15
                    285: #define DT_SYMBOLIC    16
                    286: #define DT_REL         17
                    287: #define DT_RELSZ       18
                    288: #define DT_RELENT      19
                    289: #define DT_PLTREL      20
                    290: #define DT_DEBUG       21
                    291: #define DT_TEXTREL     22
                    292: #define DT_JMPREL      23
                    293: 
                    294: /*
                    295:  *     Bootstrap doesn't need machine dependent extensions.
                    296:  */
                    297: 
                    298: #endif /* _MACH_EXEC_ELF_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.