coff.h revision 50477
13584Ssos/*- 23584Ssos * Copyright (c) 1994 Sean Eric Fagan 33584Ssos * Copyright (c) 1994 S�ren Schmidt 43584Ssos * All rights reserved. 53584Ssos * 63584Ssos * Redistribution and use in source and binary forms, with or without 73584Ssos * modification, are permitted provided that the following conditions 83584Ssos * are met: 93584Ssos * 1. Redistributions of source code must retain the above copyright 103584Ssos * notice, this list of conditions and the following disclaimer 113584Ssos * in this position and unchanged. 123584Ssos * 2. Redistributions in binary form must reproduce the above copyright 133584Ssos * notice, this list of conditions and the following disclaimer in the 143584Ssos * documentation and/or other materials provided with the distribution. 153584Ssos * 3. The name of the author may not be used to endorse or promote products 1613765Smpp * derived from this software without specific prior written permission 173584Ssos * 183584Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 193584Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 203584Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 213584Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 223584Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 233584Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 243584Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 253584Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 263584Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 273584Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 283584Ssos * 2950477Speter * $FreeBSD: head/sys/i386/ibcs2/coff.h 50477 1999-08-28 01:08:13Z peter $ 303584Ssos */ 313584Ssos 323584Ssos#ifndef _COFF_H 333584Ssos#define _COFF_H 343584Ssos 353584Ssosstruct filehdr { 363584Ssos unsigned short f_magic; /* magic number */ 373584Ssos unsigned short f_nscns; /* # of sections */ 383584Ssos long f_timdat; /* time stamp */ 393584Ssos long f_symptr; /* symbol table offset */ 403584Ssos long f_nsyms; /* # of symbols */ 413584Ssos unsigned short f_opthdr; /* size of system header */ 423584Ssos unsigned short f_flags; /* flags, see below */ 433584Ssos}; 443584Ssos 453584Ssosenum filehdr_flags { 463584Ssos F_RELFLG = 0x01, /* relocs have been stripped */ 473584Ssos F_EXEC = 0x02, /* executable file (or shlib) */ 483584Ssos F_LNNO = 0x04, /* line numbers have been stripped */ 493584Ssos F_LSYMS = 0x08, /* symbols have been stripped */ 503584Ssos F_SWABD = 0x40, /* swabbed byte names */ 513584Ssos F_AR16WR = 0x80, /* 16-bit, byte reversed words */ 523584Ssos F_AR32WR = 0x100 /* 32-bit, byte reversed words */ 533584Ssos}; 543584Ssos 553584Ssosstruct aouthdr { 563584Ssos short magic; /* magic number -- see below */ 573584Ssos short vstamp; /* artifacts from a by-gone day */ 583584Ssos long tsize; /* */ 593584Ssos long dsize; /* */ 603584Ssos long bsize; /* */ 613584Ssos long entry; /* Entry point -- offset into file */ 623584Ssos long tstart; /* artifacts from a by-gone day */ 633584Ssos long dstart; /* */ 643584Ssos}; 653584Ssos 663584Ssos#define I386_COFF 0x14c 673584Ssos 683584Ssos#define COFF_OMAGIC 0407 /* impure format */ 693584Ssos#define COFF_NMAGIC 0410 /* read-only text */ 703584Ssos#define COFF_ZMAGIC 0413 /* pagable from disk */ 713584Ssos#define COFF_SHLIB 0443 /* a shared library */ 723584Ssos 733584Ssosstruct scnhdr { 743584Ssos char s_name[8]; /* name of section (e.g., ".text") */ 753584Ssos long s_paddr; /* physical addr, used for standalone */ 763584Ssos long s_vaddr; /* virtual address */ 773584Ssos long s_size; /* size of section */ 783584Ssos long s_scnptr; /* file offset of section */ 793584Ssos long s_relptr; /* points to relocs for section */ 803584Ssos long s_lnnoptr; /* points to line numbers for section */ 813584Ssos unsigned short s_nreloc; /* # of relocs */ 823584Ssos unsigned short s_nlnno; /* # of line no's */ 833584Ssos long s_flags; /* section flags -- see below */ 843584Ssos}; 853584Ssos 863584Ssosenum scnhdr_flags { 873584Ssos STYP_REG = 0x00, /* regular (alloc'ed, reloc'ed, loaded) */ 883584Ssos STYP_DSECT = 0x01, /* dummy (reloc'd) */ 893584Ssos STYP_NOLOAD = 0x02, /* no-load (reloc'd) */ 903584Ssos STYP_GROUP = 0x04, /* grouped */ 913584Ssos STYP_PAD = 0x08, /* padding (loaded) */ 923584Ssos STYP_COPY = 0x10, /* ??? */ 933584Ssos STYP_TEXT = 0x20, /* text */ 943584Ssos STYP_DATA = 0x40, /* data */ 953584Ssos STYP_BSS = 0x80, /* bss */ 963584Ssos STYP_INFO = 0x200, /* comment (!loaded, !alloc'ed, !reloc'd) */ 973584Ssos STYP_OVER = 0x400, /* overlay (!allocated, reloc'd, !loaded) */ 983584Ssos STYP_LIB = 0x800 /* lists shared library files */ 993584Ssos}; 1003584Ssos 1013584Ssosstruct slhdr { 1023584Ssos long entry_length; 1033584Ssos long path_index; 1043584Ssos char *shlib_name; 1053584Ssos}; 1063584Ssos#endif /* _COFF_H */ 107