minor reorg of tranlee's stuff
[deliverable/binutils-gdb.git] / gas / config / coff.gnu.h
CommitLineData
a39116f1 1/* coff.gnu.h
01170860 2 Copyright (C) 1987, 1992 Free Software Foundation, Inc.
a39116f1
RP
3
4 This file is part of GAS, the GNU Assembler.
5
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
fecd2382
RP
20/*
21 * At this point I'm sure this file is right for i960 and I'm pretty sure it's
22 * right for a29k, although it hasn't been tested rigorously. Please feel free
23 * to add your own machine's description here. Without that info, it isn't
24 * possible to build cross development tools from elsewhere nor is it easy to
25 * continue to support your machines format.
26 *
27 * The TC_foo ifdef's are mine. They are what gas uses. The other ifdef's
28 * remain for documentation from other scavenged files. xoxorich.
29 */
30
fecd2382
RP
31/********************** FILE HEADER **********************/
32
33struct filehdr {
34 unsigned short f_magic; /* magic number */
35 unsigned short f_nscns; /* number of sections */
36 long f_timdat; /* time & date stamp */
37 long f_symptr; /* file pointer to symtab */
38 long f_nsyms; /* number of symtab entries */
39 unsigned short f_opthdr; /* sizeof(optional hdr) */
40 unsigned short f_flags; /* flags */
41};
42
43/* Bits for f_flags:
44 * F_RELFLG relocation info stripped from file
45 * F_EXEC file is executable (no unresolved externel references)
46 * F_LNNO line nunbers stripped from file
47 * F_LSYMS local symbols stripped from file
48 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
49 */
50#define F_RELFLG (0x0001)
51#define F_EXEC (0x0002)
52#define F_LNNO (0x0004)
53#define F_LSYMS (0x0008)
54
55#ifdef TC_I960
56#define F_AR32WR (0x0010) /* File has 32 bits per word, least
57 significant byte first. */
58#else /* TC_I960 */
59#define F_AR32WR (0x0100)
60#endif /* TC_I960 */
61
62#define F_MINMAL (0x0010) /* ??? */
63#define F_UPDATE (0x0020) /* ??? */
64#define F_SWABD (0x0040) /* ??? */
65#define F_AR16WR (0x0080) /* File has the byte ordering used by
66 the PDP*-11/70 processor. */
67#define F_AR32W (0x0200) /* File has 32 bits per word, most
68 significant byte first. */
69
70/*
71 * Intel 80960 (I960) processor flags.
72 * F_I960TYPE == mask for processor type field.
73 */
74
75#define F_I960TYPE (0xf000)
76#define F_I960CORE (0x1000)
77#define F_I960KB (0x2000)
78#define F_I960SB (0x2000)
79#define F_I960MC (0x3000)
80#define F_I960XA (0x4000)
81#define F_I960CA (0x5000)
82#define F_I960KA (0x6000)
83#define F_I960SA (0x6000)
84
85/*
86 * i80960 Magic Numbers
87 */
88
89#define I960ROMAGIC (0x160) /* read-only text segments */
90#define I960RWMAGIC (0x161) /* read-write text segments */
91
92#define I960BADMAG(x) (((x).f_magic != I960ROMAGIC) && ((x).f_magic != I960RWMAGIC))
93
94#define SIPFBOMAGIC (0x17a) /* Am29000 (Byte 0 is MSB - Big Endian) */
95#define SIPRBOMAGIC (0x17b) /* Am29000 (Byte 0 is LSB - Little Endian) */
96
97#define A29KBADMAG(x) (((x).f_magic != SIPFBOMAGIC) && ((x).f_magic != SIPRBOMAGIC))
98
879982e6
RP
99#ifdef TE_I386AIX
100# define I386MAGIC (0x175) /* Danbury AIX C compiler */
101# define I386SVMAGIC (0x14c) /* System V C Compiler */
102# define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && \
103 ((x).f_magic!=I386SVMAGIC))
104#else /* not TE_I386AIX */
105# define I386MAGIC 0x14c
106# define I386BADMAG(x) (((x).f_magic!=I386MAGIC))
107#endif /* not TE_I386AIX */
108
109
fecd2382
RP
110#define FILHDR struct filehdr
111#define FILHSZ sizeof(FILHDR)
112
113
114/********************** AOUT "OPTIONAL HEADER" **********************/
115
116typedef struct {
117 unsigned long phys_addr;
118 unsigned long bitarray;
119} TAGBITS;
120
121/* These appear to be used only by exec(2). I don't know who cares
122 about them in a cross development environment. In any case, this
123 is my collection after researching the issue for a few hours.
124 Apparently, most have these have remained essentially unchanged
125 since v7 days, although a few new ones have been added. xoxorich. */
126
127#define BAD0MAGIC (0401) /* (?) "lpd (UNIX/RT)" */
128#define BAD1MAGIC (0405) /* (?) overlay */
129#define OMAGIC (0407) /* old impure format. data immediately
130 follows text. both sections are rw. */
131#define NMAGIC (0410) /* split i&d, read-only text */
132#define A_MAGIC3 (0411) /* (?) "separated I&D" */
133#define ZMAGIC (0413) /* like NMAGIC, but demand loaded */
134#define PAGEMAGIC2 (0414) /* (?) like ZMAGIC, but address zero
135 explicitly unmapped. */
136#define REGMAGIC (0414) /* (?) a PAGEMAGIC2 alias? */
137#define PAGEMAGIC3 (0415) /* (?) like ZMAGIC, but address zero mapped. */
138#define A_MAGIC5 (0437) /* (?) "system overlay, separated I&D" */
a39116f1 139/* intended for non-unix cross development */
fecd2382
RP
140#define SASMAGIC (010000) /* Single Address Space */
141#define MASMAGIC (020000) /* (?) "Multiple (separate I & D) Address Spaces" */
142
143typedef struct aouthdr {
144 short magic; /* type of file */
145 short vstamp; /* version stamp */
146 unsigned long tsize; /* text size in bytes, padded to FW bdry*/
147 unsigned long dsize; /* initialized data " " */
148 unsigned long bsize; /* uninitialized data " " */
149#if U3B
150 unsigned long dum1;
151 unsigned long dum2; /* pad to entry point */
152#endif
153 unsigned long entry; /* entry pt. */
154 unsigned long text_start; /* base of text used for this file */
155 unsigned long data_start; /* base of data used for this file */
a39116f1 156 /* CAREFUL: some formats omit the tagentries member. */
fecd2382
RP
157 unsigned long tagentries; /* number of tag entries to
158 follow (always zero for i960) */
159} AOUTHDR;
160
161/* return a pointer to the tag bits array */
162
163#define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
164
165/* compute size of a header */
166
167/*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
168#define AOUTSZ (sizeof(AOUTHDR))
169
170
171/********************** STORAGE CLASSES **********************/
172
173#define C_EFCN -1 /* physical end of function */
174#define C_NULL 0
175#define C_AUTO 1 /* automatic variable */
176#define C_EXT 2 /* external symbol */
177#define C_STAT 3 /* static */
178#define C_REG 4 /* register variable */
179#define C_EXTDEF 5 /* external definition */
180#define C_LABEL 6 /* label */
181#define C_ULABEL 7 /* undefined label */
182#define C_MOS 8 /* member of structure */
183#define C_ARG 9 /* function argument */
184#define C_STRTAG 10 /* structure tag */
185#define C_MOU 11 /* member of union */
186#define C_UNTAG 12 /* union tag */
187#define C_TPDEF 13 /* type definition */
188#define C_USTATIC 14 /* undefined static */
189#define C_ENTAG 15 /* enumeration tag */
190#define C_MOE 16 /* member of enumeration */
191#define C_REGPARM 17 /* register parameter */
192#define C_FIELD 18 /* bit field */
193
194#ifdef TC_I960
195#define C_AUTOARG 19 /* auto argument */
196#define C_LASTENT 20 /* dummy entry (end of block) */
197#endif /* TC_I960 */
198
199#ifdef TC_A29K
200#define C_GLBLREG 19 /* global register */
201#define C_EXTREG 20 /* external global register */
202#define C_DEFREG 21 /* ext. def. of global register */
203#define C_STARTOF 22 /* as29 $SIZEOF and $STARTOF symbols */
204#endif /* TC_A29K */
205
206#define C_BLOCK 100 /* ".bb" or ".eb" */
207#define C_FCN 101 /* ".bf" or ".ef" */
208#define C_EOS 102 /* end of structure */
209#define C_FILE 103 /* file name */
210#define C_LINE 104 /* line # reformatted as symbol table entry */
211#define C_ALIAS 105 /* duplicate tag */
212#define C_HIDDEN 106 /* ext symbol in dmert public lib. like static,
213 used to avoid name conflicts. */
214
215#ifdef TC_I960
a39116f1 216/* New storage classes for 80960 */
fecd2382 217#define C_SCALL 107 /* Procedure reachable via system call */
a39116f1 218/* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */
fecd2382
RP
219#define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */
220#define C_LEAFEXT 108
221#define C_OPTVAR 109 /* Optimized variable */
222#define C_DEFINE 110 /* Preprocessor #define */
223#define C_PRAGMA 111 /* Advice to compiler or linker */
224#define C_SEGMENT 112 /* 80960 segment name */
225#define C_LEAFSTAT 113 /* Static leaf */
226#endif /* TC_I960 */
227
228#ifdef TC_A29K
229#define C_SHADOW 107 /* shadow symbol */
230#endif /* TC_A29K */
231
232/********************** SECTION HEADER **********************/
233
234struct scnhdr {
235 char s_name[8]; /* section name */
236 long s_paddr; /* physical address, aliased s_nlib */
237 long s_vaddr; /* virtual address */
238 long s_size; /* section size */
239 long s_scnptr; /* file ptr to raw data for section */
240 long s_relptr; /* file ptr to relocation */
241 long s_lnnoptr; /* file ptr to line numbers */
242 unsigned short s_nreloc; /* number of relocation entries */
243 unsigned short s_nlnno; /* number of line number entries */
244 long s_flags; /* flags */
a39116f1 245
fecd2382
RP
246#ifdef TC_I960
247 unsigned long s_align; /* section alignment */
248#endif /* TC_I960 */
249};
250
251#define SCNHDR struct scnhdr
252#define SCNHSZ sizeof(SCNHDR)
253
254/*
255 * names of "special" sections
256 */
879982e6
RP
257#define _TEXT ".text" /* executable code section */
258#define _DATA ".data" /* initialized data */
259#define _BSS ".bss" /* un-initialized data */
260#define _DEBUG ".debug" /* special section used by dbx */
261#define _COMMENT ".comment" /* version info */
262#define _LIB ".lib" /* shared lib info section */
263#define _TV ".tv"
fecd2382
RP
264
265/*
266 * s_flags "type"
267 */
268
269/*
270 * In instances where it is necessary for a linker to
271 * produce an output file which contains text or data not
272 * based at virtual address 0, e.g. for a ROM, then the
273 * linker should accept address base information as command
274 * input and use PAD sections to skip over unused addresses.
275 * (at least for a29k. Maybe others.)
276 */
277
278#define STYP_REG (0x0000) /* "regular" section: allocated, relocated, loaded */
279#define STYP_DSECT (0x0001) /* "dummy" section: not allocated, relocated, not loaded */
280#define STYP_NOLOAD (0x0002) /* "noload" section: allocated, relocated, not loaded */
281#define STYP_GROUP (0x0004) /* "grouped" section: formed of input sections */
282#define STYP_PAD (0x0008) /* "padding" section: not allocated, not relocated, loaded */
283#define STYP_COPY (0x0010) /* "copy" section: for decision function used by field update; not allocated, not relocated,
284 loaded; reloc & lineno entries processed normally */
285#define STYP_TEXT (0x0020) /* section contains text only */
286#define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
287 will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
288 update all process invocations. */
289#define STYP_DATA (0x0040) /* section contains data only */
290#define STYP_BSS (0x0080) /* section contains bss only */
291#define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
292#define STYP_INFO (0x0200) /* comment section : not allocated not relocated, not loaded */
293#define STYP_OVER (0x0400) /* overlay section : relocated not allocated or loaded */
294#define STYP_LIB (0x0800) /* for .lib section : same as INFO */
295#define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
296#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
297 word of contiguous bytes beginning on a word boundary. */
298
299#ifdef TC_A29K
300/* NOTE: The use of STYP_BSSREG for relocation is not yet defined. */
301#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
302#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
303#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
304#define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */
305#endif /* TC_A29K */
306
307/********************** LINE NUMBERS **********************/
308
309/* 1 line number entry for every "breakpointable" source line in a section.
310 * Line numbers are grouped on a per function basis; first entry in a function
311 * grouping will have l_lnno = 0 and in place of physical address will be the
312 * symbol table index of the function name.
313 */
314struct lineno {
315 union {
316 long l_symndx; /* symbol index of function name, iff l_lnno == 0*/
317 long l_paddr; /* (physical) address of line number */
318 } l_addr;
319 unsigned short l_lnno; /* line number */
320#ifdef TC_I960
a39116f1 321 /* not used on a29k */
fecd2382
RP
322 char padding[2]; /* force alignment */
323#endif /* TC_I960 */
324};
325
326#define LINENO struct lineno
327#define LINESZ sizeof(LINENO)
328
329
330/********************** SYMBOLS **********************/
331
a39116f1
RP
332#define SYMNMLEN 8 /* # characters in a symbol name */
333#define FILNMLEN 14 /* # characters in a file name */
fecd2382
RP
334#define DIMNUM 4 /* # array dimensions in auxiliary entry */
335
336struct syment {
337 union {
a39116f1 338 char _n_name[SYMNMLEN]; /* old COFF version */
fecd2382 339 struct {
a39116f1 340 long _n_zeroes; /* new == 0 */
fecd2382
RP
341 long _n_offset; /* offset into string table */
342 } _n_n;
a39116f1 343 char *_n_nptr[2]; /* allows for overlaying */
fecd2382 344 } _n;
a39116f1
RP
345 long n_value; /* value of symbol */
346 short n_scnum; /* section number */
347
fecd2382 348#ifdef TC_I960
a39116f1
RP
349 /* This isn't yet used on the i960. In some formats this
350 is two bytes of padding. In others, it is missing entirely. */
351 unsigned short n_flags; /* copy of flags from filhdr */
fecd2382 352#endif /* TC_I960 */
a39116f1 353
fecd2382 354#ifdef TC_A29K
a39116f1 355 unsigned short n_type; /* type and derived type */
fecd2382 356#else /* TC_A29K */
a39116f1
RP
357 /* at least i960 uses long */
358 unsigned long n_type; /* type and derived type */
fecd2382 359#endif /* TC_A29K */
a39116f1
RP
360
361 char n_sclass; /* storage class */
362 char n_numaux; /* number of aux. entries */
363
fecd2382 364#ifndef TC_A29K
a39116f1 365 char pad2[2]; /* force alignment */
fecd2382
RP
366#endif /* TC_A29K */
367};
368
369#define SYMENT struct syment
370#define SYMESZ sizeof(SYMENT) /* This had better also be sizeof(AUXENT) */
371
372#define n_name _n._n_name
373#define n_ptr _n._n_nptr[1]
374#define n_zeroes _n._n_n._n_zeroes
375#define n_offset _n._n_n._n_offset
a39116f1
RP
376
377 /*
378 * Relocatable symbols have number of the section in which they are defined,
379 * or one of the following:
380 */
381
fecd2382
RP
382#define N_SCNUM ((short) 1-65535) /* section num where symbol defined */
383#define N_UNDEF ((short)0) /* undefined symbol */
384#define N_ABS ((short)-1) /* value of symbol is absolute */
385#define N_DEBUG ((short)-2) /* debugging symbol -- symbol value is meaningless */
386#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
387#define P_TV ((short)-4) /* indicates symbol needs transfer vector (postload) */
388
389/*
390 * Type of a symbol, in low 4 bits of the word
391 */
392#define T_NULL 0 /* type not assigned */
a39116f1 393#define T_VOID 1 /* function argument (only used by compiler) (but now real void). */
fecd2382
RP
394#define T_CHAR 2 /* character */
395#define T_SHORT 3 /* short integer */
396#define T_INT 4 /* integer */
397#define T_LONG 5 /* long integer */
398#define T_FLOAT 6 /* floating point */
399#define T_DOUBLE 7 /* double word */
400#define T_STRUCT 8 /* structure */
401#define T_UNION 9 /* union */
402#define T_ENUM 10 /* enumeration */
403#define T_MOE 11 /* member of enumeration */
404#define T_UCHAR 12 /* unsigned character */
405#define T_USHORT 13 /* unsigned short */
406#define T_UINT 14 /* unsigned integer */
407#define T_ULONG 15 /* unsigned long */
408
409#ifdef TC_I960
410#define T_LNGDBL 16 /* long double */
411#endif /* TC_I960 */
412
413/*
414 * derived types, in n_type
415 */
416#define DT_NON (0) /* no derived type */
417#define DT_PTR (1) /* pointer */
418#define DT_FCN (2) /* function */
419#define DT_ARY (3) /* array */
420
421#ifndef TC_I960
422
423#define N_BTMASK (0x0f)
424#define N_TMASK (0x30)
425#define N_BTSHFT (4)
426#define N_TSHIFT (2)
427
428#else /* TC_I960 */
429
430#define N_BTMASK (0x1f)
431#define N_TMASK (0x60)
432#define N_BTSHFT (5)
433#define N_TSHIFT (2)
434
435#endif /* TC_I960 */
436
437#define BTYPE(x) ((x) & N_BTMASK)
438
439#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
440#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
441#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
442
443#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
444
445union auxent {
446 struct {
447 long x_tagndx; /* str, un, or enum tag indx */
448 union {
449 struct {
a39116f1
RP
450 unsigned short x_lnno; /* declaration line number */
451 unsigned short x_size; /* str/union/array size */
fecd2382
RP
452 } x_lnsz;
453 long x_fsize; /* size of function */
454 } x_misc;
455 union {
456 struct { /* if ISFCN, tag, or .bb */
a39116f1
RP
457 long x_lnnoptr; /* ptr to fcn line # */
458 long x_endndx; /* entry ndx past block end */
fecd2382
RP
459 } x_fcn;
460 struct { /* if ISARY, up to 4 dimen. */
a39116f1 461 unsigned short x_dimen[DIMNUM];
fecd2382
RP
462 } x_ary;
463 } x_fcnary;
464 unsigned short x_tvndx; /* tv index */
465 } x_sym;
a39116f1
RP
466
467 /* This was just a struct x_file with x_fname only in a29k. xoxorich. */
fecd2382
RP
468 union {
469 char x_fname[FILNMLEN];
470 struct {
471 long x_zeroes;
472 long x_offset;
473 } x_n;
474 } x_file;
a39116f1 475
fecd2382
RP
476 struct {
477 long x_scnlen; /* section length */
478 unsigned short x_nreloc; /* # relocation entries */
479 unsigned short x_nlinno; /* # line numbers */
480 } x_scn;
a39116f1 481
fecd2382
RP
482 struct {
483 long x_tvfill; /* tv fill value */
484 unsigned short x_tvlen; /* length of .tv */
a39116f1
RP
485
486 /* This field was typo'd x_tvrna on a29k. xoxorich. */
fecd2382
RP
487 unsigned short x_tvran[2]; /* tv range */
488 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
a39116f1 489
fecd2382
RP
490#ifdef TC_I960
491 /******************************************
492 * I960-specific *2nd* aux. entry formats
493 ******************************************/
494 struct {
a39116f1 495 /* This is a very old typo that keeps getting propogated. */
fecd2382
RP
496#define x_stdindx x_stindx
497 long x_stindx; /* sys. table entry */
498 } x_sc; /* system call entry */
a39116f1 499
fecd2382
RP
500 struct {
501 unsigned long x_balntry; /* BAL entry point */
502 } x_bal; /* BAL-callable function */
a39116f1 503
fecd2382
RP
504 struct {
505 unsigned long x_timestamp; /* time stamp */
506 char x_idstring[20]; /* producer identity string */
507 } x_ident; /* Producer ident info */
a39116f1 508
fecd2382
RP
509 char a[sizeof(struct syment)]; /* force auxent/syment sizes to match */
510#endif /* TC_I960 */
511};
512
513#define AUXENT union auxent
514#define AUXESZ sizeof(AUXENT) /* This had better also be sizeof(SYMENT) */
515
516#if VAX || I960
517# define _ETEXT "_etext"
518#else
519# define _ETEXT "etext"
520#endif
521
522/********************** RELOCATION DIRECTIVES **********************/
523
524struct reloc {
525 long r_vaddr; /* Virtual address of reference */
526 long r_symndx; /* Index into symbol table */
527 unsigned short r_type; /* Relocation type */
528#ifdef TC_I960
a39116f1 529 /* not used for a29k */
fecd2382
RP
530 char pad[2]; /* Unused */
531#endif /* TC_I960 */
532};
533
534#define RELOC struct reloc
535#define RELSZ sizeof(RELOC)
536
879982e6
RP
537#define R_ABS (0x00) /* reference is absolute */
538
fecd2382
RP
539#ifdef TC_I960
540#define R_RELLONG (0x11) /* Direct 32-bit relocation */
541#define R_IPRSHORT (0x18)
542#define R_IPRMED (0x19) /* 24-bit ip-relative relocation */
543#define R_IPRLONG (0x1a)
544#define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */
545#define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */
546#define R_GETSEG (0x1d)
547#define R_GETPA (0x1e)
548#define R_TAGWORD (0x1f)
549#endif /* TC_I960 */
550
551#ifdef TC_A29K
552/*
553 * NOTE: All the "I" forms refer to Am29000 instruction
554 * formats. The linker is expected to know how the numeric
555 * information is split and/or aligned within the
556 * instruction word(s). R_BYTE works for instructions, too.
557 *
558 * If the parameter to a CONSTH instruction is a relocatable
559 * type, two relocation records are written. The first has
560 * an r_type of R_IHIHALF (33 octal) and a normal r_vaddr
561 * and r_symndx. The second relocation record has an r_type
562 * of R_IHCONST (34 octal), a normal r_vaddr (which is
563 * redundant), and an r_symndx containing the 32-bit
564 * constant offset to the relocation instead of the actual
565 * symbol table index. This second record is always
566 * written, even if the constant offset is zero. The
567 * constant fields of the instruction are set to zero.
568 */
569
fecd2382
RP
570#define R_IREL (0x18) /* instruction relative (jmp/call) */
571#define R_IABS (0x19) /* instruction absolute (jmp/call) */
572#define R_ILOHALF (0x1a) /* instruction low half (const) */
573#define R_IHIHALF (0x1b) /* instruction high half (consth) part 1 */
574#define R_IHCONST (0x1c) /* instruction high half (consth) part 2
575 constant offset of R_IHIHALF relocation */
576#define R_BYTE (0x1d) /* relocatable byte value */
577#define R_HWORD (0x1e) /* relocatable halfword value */
578#define R_WORD (0x1f) /* relocatable word value */
579#define R_IGLBLRC (0x20) /* instruction global register RC */
580#define R_IGLBLRA (0x21) /* instruction global register RA */
581#define R_IGLBLRB (0x22) /* instruction global register RB */
582#endif /* TC_A29K */
583
584
585#define DEFAULT_DATA_SECTION_ALIGNMENT 4
586#define DEFAULT_BSS_SECTION_ALIGNMENT 4
587#define DEFAULT_TEXT_SECTION_ALIGNMENT 16
a39116f1 588/* For new sections we haven't heard of before */
fecd2382
RP
589#define DEFAULT_SECTION_ALIGNMENT 4
590
879982e6
RP
591#if defined(TC_I386)
592/*
593 * X86 generic
594 * 8-bit offset reference in 8-bits
595 * 8-bit offset reference in 16-bits
596 * 12-bit segment reference
597 * auxiliary relocation entry
598 */
599#define R_OFF8 07
600#define R_OFF16 010
601#define R_SEG12 011
602#define R_AUX 013
603
604/*
605 * B16 and X86 generics
606 * 16-bit direct reference
607 * 16-bit "relative" reference
608 * 16-bit "indirect" (TV) reference
609 */
610#define R_DIR16 01
611#define R_REL16 02
612#define R_IND16 03
613
614/*
615 * 3B generic
616 * 24-bit direct reference
617 * 24-bit "relative" reference
618 * 16-bit optimized "indirect" TV reference
619 * 24-bit "indirect" TV reference
620 * 32-bit "indirect" TV reference
621 */
622#define R_DIR24 04
623#define R_REL24 05
624#define R_OPT16 014
625#define R_IND24 015
626#define R_IND32 016
627
628/*
629 * XL generics
630 * 10-bit direct reference
631 * 10-bit "relative" reference
632 * 32-bit "relative" reference
633 */
634#define R_DIR10 025
635#define R_REL10 026
636#define R_REL32 027
637
638/*
639 * 3B and M32 generics
640 * 32-bit direct reference
641 */
642#define R_DIR32 06
643
644/*
645 * M32 generic
646 * 32-bit direct reference with bytes swapped
647 */
648#define R_DIR32S 012
649
650#endif /* TC_I386 */
651
652#if defined(TE_I386AIX)
653
654#define UINFOSIZ 64 /* size of user info buffer */
655typedef char uinfo_t[UINFOSIZ];
656
657struct env387 {
658 unsigned short control;
659 unsigned short r0;
660 unsigned short status;
661 unsigned short r1;
662 unsigned short tag;
663 unsigned short r2;
664 unsigned long eip;
665 unsigned short code_seg;
666 unsigned short opcode;
667 unsigned long operand;
668 unsigned short operand_seg;
669 unsigned short r3;
670 unsigned char regs[8][10];
671};
672
673#define CD_NAMELEN 16 /* length of most names in this header */
674#define CORHDRSIZ 2048 /* size to which header is padded out */
675#define MAX_CORE_SEGS 32 /* maximum segments in a core dump */
676#define NUM_FREGS 1 /* # of saved FP regs */
677
678/*
679 * These are defined such that 286 and 386 kernels can produce
680 * compatible dumps.
681 */
682#define CD_AX 0
683#define CD_BX 1
684#define CD_CX 2
685#define CD_DX 3
686#define CD_SI 4
687#define CD_DI 5
688#define CD_BP 6
689#define CD_SP 7
690#define CD_FL 8
691#define CD_IP 9
692#define CD_CS 10
693#define CD_DS 11
694#define CD_ES 12
695#define CD_FS 13
696#define CD_GS 14
697#define CD_SS 15
698#define NUM_REGS 16
699
700#ifndef SPATHLEN
701# define SPATHLEN 16 /* sys/param.h */
702#endif
703#ifndef NSIG
704# define NSIG 63 /* sys/signal.h */
705# define SIGSETSZ ((NSIG+31)/32)
706typedef struct ksigmask {
707 unsigned long sigs[SIGSETSZ];
708} ksigmask_t;
709#endif
710
711struct corehdr {
712 char cd_magic[4]; /* COR_MAGIC = "core" */
713
714 /* general information about the dump itself */
715 struct dumpseg { /* table of contents for dump */
716 long cs_type; /* seg. type; see below */
717 long cs_len; /* length (in bytes) of segment */
718 long cs_offset; /* offset (in dump) of segment */
719 long cs_address; /* address segment had in mem */
720 } cd_segs[MAX_CORE_SEGS];
721
722 /* general information about the process */
723 char cd_comm[CD_NAMELEN]; /* command being run */
724 char cd_mach[CD_NAMELEN]; /* type of machine it ran on */
725 char cd_site[CD_NAMELEN]; /* name of site it ran on */
726 long cd_ldtype; /* type of load module running */
727 char cd_intsize; /* sizeof(int) */
728 char cd_dptrsize; /* sizeof(char *) */
729 char cd_tptrsize; /* sizeof(int (*)()) */
730 char cd_unused;
731
732 /* user-mode program state */
733 long cd_regs[NUM_REGS]; /* user-mode general registers */
734 struct env387 cd_fpregs; /* user-mode floating-point state */
735
736 /* kernel-mode program state */
737 int (*cd_sig[NSIG])(); /* disposition of signals */
738 ksigmask_t cd_sigmask; /* signals to be blocked */
739 ksigmask_t cd_sigpend; /* signals currently pending */
740 long cd_cursig; /* signal that caused the dump */
741
742 long cd_pid; /* process ID of the corpse */
743 long cd_ppid; /* parent process ID of corpse */
744 short cd_uid; /* process effective user ID */
745 short cd_ruid; /* process real user ID */
746 short cd_gid; /* process effective group ID */
747 short cd_rgid; /* process real group ID */
748
749 uinfo_t cd_uinfo; /* buffer of user information */
750 char cd_locname[32]; /* name of /local */
751 char cd_uvers[CD_NAMELEN]; /* user version string */
752 unsigned short cd_spath[SPATHLEN]; /* sitepath */
753};
754
755#ifndef NOCHECKS
756/* this will generate an error if sizeof(struct corehdr) > CORHDRSIZ */
757struct { char xxcdxx[CORHDRSIZ+1-sizeof(struct corehdr)]; };
758#endif /* ! NOCHECKS */
759
760/*
761 * segment types (in cs_type)
762 * each segment in the address space appears here, whether or not it
763 * is actually dumped. Read/only segments will not actually be dumped.
764 * A segment that is not in the dump will have a cs_offset of zero.
765 */
766#define COR_TYPE_CODE 'x' /* process code - NOT IN DUMP */
767#define COR_TYPE_DATA 'd' /* process data segment */
768#define COR_TYPE_STACK 's' /* process stack segment */
769#define COR_TYPE_LIBCODE 'X' /* shared lib code - NOT IN DUMP*/
770#define COR_TYPE_LIBDATA 'D' /* shared lib data */
771#define COR_TYPE_READ 'r' /* other read/only - NOT IN DUMP*/
772#define COR_TYPE_WRITE 'w' /* other writeable */
773#define COR_TYPE_MSC '?' /* other, mapped in segment */
774
775#endif /* TE_I386AIX */
776
fecd2382
RP
777/*
778 * Local Variables:
779 * comment-column: 0
780 * End:
781 */
782
783/* end of coff.gnu.h */
This page took 0.068311 seconds and 4 git commands to generate.