1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _UAPI_LINUX_COFF_H 8 #define _UAPI_LINUX_COFF_H 9 #define E_SYMNMLEN 8 10 #define E_FILNMLEN 14 11 #define E_DIMNUM 4 12 #define COFF_SHORT_L(ps) ((short) (((unsigned short) ((unsigned char) ps[1]) << 8) | ((unsigned short) ((unsigned char) ps[0])))) 13 #define COFF_LONG_L(ps) (((long) (((unsigned long) ((unsigned char) ps[3]) << 24) | ((unsigned long) ((unsigned char) ps[2]) << 16) | ((unsigned long) ((unsigned char) ps[1]) << 8) | ((unsigned long) ((unsigned char) ps[0]))))) 14 #define COFF_SHORT_H(ps) ((short) (((unsigned short) ((unsigned char) ps[0]) << 8) | ((unsigned short) ((unsigned char) ps[1])))) 15 #define COFF_LONG_H(ps) (((long) (((unsigned long) ((unsigned char) ps[0]) << 24) | ((unsigned long) ((unsigned char) ps[1]) << 16) | ((unsigned long) ((unsigned char) ps[2]) << 8) | ((unsigned long) ((unsigned char) ps[3]))))) 16 #define COFF_LONG(v) COFF_LONG_L(v) 17 #define COFF_SHORT(v) COFF_SHORT_L(v) 18 struct COFF_filehdr { 19 char f_magic[2]; 20 char f_nscns[2]; 21 char f_timdat[4]; 22 char f_symptr[4]; 23 char f_nsyms[4]; 24 char f_opthdr[2]; 25 char f_flags[2]; 26 }; 27 #define COFF_F_RELFLG 0000001 28 #define COFF_F_EXEC 0000002 29 #define COFF_F_LNNO 0000004 30 #define COFF_F_LSYMS 0000010 31 #define COFF_F_MINMAL 0000020 32 #define COFF_F_UPDATE 0000040 33 #define COFF_F_SWABD 0000100 34 #define COFF_F_AR16WR 0000200 35 #define COFF_F_AR32WR 0000400 36 #define COFF_F_AR32W 0001000 37 #define COFF_F_PATCH 0002000 38 #define COFF_F_NODF 0002000 39 #define COFF_I386MAGIC 0x14c 40 #define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) 41 #define COFF_FILHDR struct COFF_filehdr 42 #define COFF_FILHSZ sizeof(COFF_FILHDR) 43 typedef struct { 44 char magic[2]; 45 char vstamp[2]; 46 char tsize[4]; 47 char dsize[4]; 48 char bsize[4]; 49 char entry[4]; 50 char text_start[4]; 51 char data_start[4]; 52 } COFF_AOUTHDR; 53 #define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) 54 #define COFF_STMAGIC 0401 55 #define COFF_OMAGIC 0404 56 #define COFF_JMAGIC 0407 57 #define COFF_DMAGIC 0410 58 #define COFF_ZMAGIC 0413 59 #define COFF_SHMAGIC 0443 60 struct COFF_scnhdr { 61 char s_name[8]; 62 char s_paddr[4]; 63 char s_vaddr[4]; 64 char s_size[4]; 65 char s_scnptr[4]; 66 char s_relptr[4]; 67 char s_lnnoptr[4]; 68 char s_nreloc[2]; 69 char s_nlnno[2]; 70 char s_flags[4]; 71 }; 72 #define COFF_SCNHDR struct COFF_scnhdr 73 #define COFF_SCNHSZ sizeof(COFF_SCNHDR) 74 #define COFF_TEXT ".text" 75 #define COFF_DATA ".data" 76 #define COFF_BSS ".bss" 77 #define COFF_COMMENT ".comment" 78 #define COFF_LIB ".lib" 79 #define COFF_SECT_TEXT 0 80 #define COFF_SECT_DATA 1 81 #define COFF_SECT_BSS 2 82 #define COFF_SECT_REQD 3 83 #define COFF_STYP_REG 0x00 84 #define COFF_STYP_DSECT 0x01 85 #define COFF_STYP_NOLOAD 0x02 86 #define COFF_STYP_GROUP 0x04 87 #define COFF_STYP_PAD 0x08 88 #define COFF_STYP_COPY 0x10 89 #define COFF_STYP_TEXT 0x20 90 #define COFF_STYP_DATA 0x40 91 #define COFF_STYP_BSS 0x80 92 #define COFF_STYP_INFO 0x200 93 #define COFF_STYP_OVER 0x400 94 #define COFF_STYP_LIB 0x800 95 struct COFF_slib { 96 char sl_entsz[4]; 97 char sl_pathndx[4]; 98 }; 99 #define COFF_SLIBHD struct COFF_slib 100 #define COFF_SLIBSZ sizeof(COFF_SLIBHD) 101 struct COFF_lineno { 102 union { 103 char l_symndx[4]; 104 char l_paddr[4]; 105 } l_addr; 106 char l_lnno[2]; 107 }; 108 #define COFF_LINENO struct COFF_lineno 109 #define COFF_LINESZ 6 110 #define COFF_E_SYMNMLEN 8 111 #define COFF_E_FILNMLEN 14 112 #define COFF_E_DIMNUM 4 113 struct COFF_syment { 114 union { 115 char e_name[E_SYMNMLEN]; 116 struct { 117 char e_zeroes[4]; 118 char e_offset[4]; 119 } e; 120 } e; 121 char e_value[4]; 122 char e_scnum[2]; 123 char e_type[2]; 124 char e_sclass[1]; 125 char e_numaux[1]; 126 }; 127 #define COFF_N_BTMASK (0xf) 128 #define COFF_N_TMASK (0x30) 129 #define COFF_N_BTSHFT (4) 130 #define COFF_N_TSHIFT (2) 131 union COFF_auxent { 132 struct { 133 char x_tagndx[4]; 134 union { 135 struct { 136 char x_lnno[2]; 137 char x_size[2]; 138 } x_lnsz; 139 char x_fsize[4]; 140 } x_misc; 141 union { 142 struct { 143 char x_lnnoptr[4]; 144 char x_endndx[4]; 145 } x_fcn; 146 struct { 147 char x_dimen[E_DIMNUM][2]; 148 } x_ary; 149 } x_fcnary; 150 char x_tvndx[2]; 151 } x_sym; 152 union { 153 char x_fname[E_FILNMLEN]; 154 struct { 155 char x_zeroes[4]; 156 char x_offset[4]; 157 } x_n; 158 } x_file; 159 struct { 160 char x_scnlen[4]; 161 char x_nreloc[2]; 162 char x_nlinno[2]; 163 } x_scn; 164 struct { 165 char x_tvfill[4]; 166 char x_tvlen[2]; 167 char x_tvran[2][2]; 168 } x_tv; 169 }; 170 #define COFF_SYMENT struct COFF_syment 171 #define COFF_SYMESZ 18 172 #define COFF_AUXENT union COFF_auxent 173 #define COFF_AUXESZ 18 174 #define COFF_ETEXT "etext" 175 struct COFF_reloc { 176 char r_vaddr[4]; 177 char r_symndx[4]; 178 char r_type[2]; 179 }; 180 #define COFF_RELOC struct COFF_reloc 181 #define COFF_RELSZ 10 182 #define COFF_DEF_DATA_SECTION_ALIGNMENT 4 183 #define COFF_DEF_BSS_SECTION_ALIGNMENT 4 184 #define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 185 #define COFF_DEF_SECTION_ALIGNMENT 4 186 #endif 187