Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 19 | #ifndef _UAPI_LINUX_COFF_H |
| 20 | #define _UAPI_LINUX_COFF_H |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 21 | #define E_SYMNMLEN 8 |
| 22 | #define E_FILNMLEN 14 |
| 23 | #define E_DIMNUM 4 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 24 | #define COFF_SHORT_L(ps) ((short) (((unsigned short) ((unsigned char) ps[1]) << 8) | ((unsigned short) ((unsigned char) ps[0])))) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 25 | #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]))))) |
| 26 | #define COFF_SHORT_H(ps) ((short) (((unsigned short) ((unsigned char) ps[0]) << 8) | ((unsigned short) ((unsigned char) ps[1])))) |
| 27 | #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]))))) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 28 | #define COFF_LONG(v) COFF_LONG_L(v) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 29 | #define COFF_SHORT(v) COFF_SHORT_L(v) |
| 30 | struct COFF_filehdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 31 | char f_magic[2]; |
| 32 | char f_nscns[2]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 33 | char f_timdat[4]; |
| 34 | char f_symptr[4]; |
| 35 | char f_nsyms[4]; |
| 36 | char f_opthdr[2]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 37 | char f_flags[2]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 38 | }; |
| 39 | #define COFF_F_RELFLG 0000001 |
| 40 | #define COFF_F_EXEC 0000002 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 41 | #define COFF_F_LNNO 0000004 |
| 42 | #define COFF_F_LSYMS 0000010 |
| 43 | #define COFF_F_MINMAL 0000020 |
| 44 | #define COFF_F_UPDATE 0000040 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 45 | #define COFF_F_SWABD 0000100 |
| 46 | #define COFF_F_AR16WR 0000200 |
| 47 | #define COFF_F_AR32WR 0000400 |
| 48 | #define COFF_F_AR32W 0001000 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 49 | #define COFF_F_PATCH 0002000 |
| 50 | #define COFF_F_NODF 0002000 |
| 51 | #define COFF_I386MAGIC 0x14c |
| 52 | #define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 53 | #define COFF_FILHDR struct COFF_filehdr |
| 54 | #define COFF_FILHSZ sizeof(COFF_FILHDR) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | typedef struct { |
| 56 | char magic[2]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 57 | char vstamp[2]; |
| 58 | char tsize[4]; |
| 59 | char dsize[4]; |
| 60 | char bsize[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 61 | char entry[4]; |
| 62 | char text_start[4]; |
| 63 | char data_start[4]; |
| 64 | } COFF_AOUTHDR; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 65 | #define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) |
| 66 | #define COFF_STMAGIC 0401 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 67 | #define COFF_OMAGIC 0404 |
| 68 | #define COFF_JMAGIC 0407 |
| 69 | #define COFF_DMAGIC 0410 |
| 70 | #define COFF_ZMAGIC 0413 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 71 | #define COFF_SHMAGIC 0443 |
| 72 | struct COFF_scnhdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 73 | char s_name[8]; |
| 74 | char s_paddr[4]; |
| 75 | char s_vaddr[4]; |
| 76 | char s_size[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 77 | char s_scnptr[4]; |
| 78 | char s_relptr[4]; |
| 79 | char s_lnnoptr[4]; |
| 80 | char s_nreloc[2]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 81 | char s_nlnno[2]; |
| 82 | char s_flags[4]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 83 | }; |
| 84 | #define COFF_SCNHDR struct COFF_scnhdr |
| 85 | #define COFF_SCNHSZ sizeof(COFF_SCNHDR) |
| 86 | #define COFF_TEXT ".text" |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 87 | #define COFF_DATA ".data" |
| 88 | #define COFF_BSS ".bss" |
| 89 | #define COFF_COMMENT ".comment" |
| 90 | #define COFF_LIB ".lib" |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 91 | #define COFF_SECT_TEXT 0 |
| 92 | #define COFF_SECT_DATA 1 |
| 93 | #define COFF_SECT_BSS 2 |
| 94 | #define COFF_SECT_REQD 3 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 95 | #define COFF_STYP_REG 0x00 |
| 96 | #define COFF_STYP_DSECT 0x01 |
| 97 | #define COFF_STYP_NOLOAD 0x02 |
| 98 | #define COFF_STYP_GROUP 0x04 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 99 | #define COFF_STYP_PAD 0x08 |
| 100 | #define COFF_STYP_COPY 0x10 |
| 101 | #define COFF_STYP_TEXT 0x20 |
| 102 | #define COFF_STYP_DATA 0x40 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 103 | #define COFF_STYP_BSS 0x80 |
| 104 | #define COFF_STYP_INFO 0x200 |
| 105 | #define COFF_STYP_OVER 0x400 |
| 106 | #define COFF_STYP_LIB 0x800 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 107 | struct COFF_slib { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 108 | char sl_entsz[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 109 | char sl_pathndx[4]; |
| 110 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 111 | #define COFF_SLIBHD struct COFF_slib |
| 112 | #define COFF_SLIBSZ sizeof(COFF_SLIBHD) |
| 113 | struct COFF_lineno { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 114 | union { |
| 115 | char l_symndx[4]; |
| 116 | char l_paddr[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 117 | } l_addr; |
| 118 | char l_lnno[2]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 119 | }; |
| 120 | #define COFF_LINENO struct COFF_lineno |
| 121 | #define COFF_LINESZ 6 |
| 122 | #define COFF_E_SYMNMLEN 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 123 | #define COFF_E_FILNMLEN 14 |
| 124 | #define COFF_E_DIMNUM 4 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 125 | struct COFF_syment { |
| 126 | union { |
| 127 | char e_name[E_SYMNMLEN]; |
| 128 | struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 129 | char e_zeroes[4]; |
| 130 | char e_offset[4]; |
| 131 | } e; |
| 132 | } e; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 133 | char e_value[4]; |
| 134 | char e_scnum[2]; |
| 135 | char e_type[2]; |
| 136 | char e_sclass[1]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 137 | char e_numaux[1]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 138 | }; |
| 139 | #define COFF_N_BTMASK (0xf) |
| 140 | #define COFF_N_TMASK (0x30) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 141 | #define COFF_N_BTSHFT (4) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 142 | #define COFF_N_TSHIFT (2) |
| 143 | union COFF_auxent { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 144 | struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 145 | char x_tagndx[4]; |
| 146 | union { |
| 147 | struct { |
| 148 | char x_lnno[2]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 149 | char x_size[2]; |
| 150 | } x_lnsz; |
| 151 | char x_fsize[4]; |
| 152 | } x_misc; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 153 | union { |
| 154 | struct { |
| 155 | char x_lnnoptr[4]; |
| 156 | char x_endndx[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 157 | } x_fcn; |
| 158 | struct { |
| 159 | char x_dimen[E_DIMNUM][2]; |
| 160 | } x_ary; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 161 | } x_fcnary; |
| 162 | char x_tvndx[2]; |
| 163 | } x_sym; |
| 164 | union { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 165 | char x_fname[E_FILNMLEN]; |
| 166 | struct { |
| 167 | char x_zeroes[4]; |
| 168 | char x_offset[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 169 | } x_n; |
| 170 | } x_file; |
| 171 | struct { |
| 172 | char x_scnlen[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 173 | char x_nreloc[2]; |
| 174 | char x_nlinno[2]; |
| 175 | } x_scn; |
| 176 | struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 177 | char x_tvfill[4]; |
| 178 | char x_tvlen[2]; |
| 179 | char x_tvran[2][2]; |
| 180 | } x_tv; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 181 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 182 | #define COFF_SYMENT struct COFF_syment |
| 183 | #define COFF_SYMESZ 18 |
| 184 | #define COFF_AUXENT union COFF_auxent |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 185 | #define COFF_AUXESZ 18 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 186 | #define COFF_ETEXT "etext" |
| 187 | struct COFF_reloc { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 188 | char r_vaddr[4]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 189 | char r_symndx[4]; |
| 190 | char r_type[2]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 191 | }; |
| 192 | #define COFF_RELOC struct COFF_reloc |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 193 | #define COFF_RELSZ 10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 194 | #define COFF_DEF_DATA_SECTION_ALIGNMENT 4 |
| 195 | #define COFF_DEF_BSS_SECTION_ALIGNMENT 4 |
| 196 | #define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 197 | #define COFF_DEF_SECTION_ALIGNMENT 4 |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 198 | #endif |