* All files: Define FILHSZ, AOUTSZ, AOUTHDRSZ, SCNHSZ, SYMESZ,
authorIan Lance Taylor <ian@airs.com>
Wed, 26 Jun 1996 20:28:29 +0000 (20:28 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 26 Jun 1996 20:28:29 +0000 (20:28 +0000)
AUXESZ, LINESZ, RELSZ as numeric constants rather than uses of
sizeof.  Define AOUTHDRSZ in all files.
* pe.h (AOUTSZ): Define by adding to AOUTHDRSZ.

include/coff/ChangeLog
include/coff/a29k.h
include/coff/m68k.h [new file with mode: 0644]
include/coff/pe.h [new file with mode: 0644]

index 9c22ae7d2aa4da6c42956740fb1116a135e74070..0f3071bb8f78a04dd2a06c74a47ee75b1762d5b6 100644 (file)
@@ -1,3 +1,31 @@
+Wed Jun 26 16:24:26 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * All files: Define FILHSZ, AOUTSZ, AOUTHDRSZ, SCNHSZ, SYMESZ,
+       AUXESZ, LINESZ, RELSZ as numeric constants rather than uses of
+       sizeof.  Define AOUTHDRSZ in all files.
+       * pe.h (AOUTSZ): Define by adding to AOUTHDRSZ.
+
+Fri Jun 21 11:17:46 1996  Richard Henderson  <rth@tamu.edu>
+
+       * alpha.h: Add declarations for relocation types added for Alpha
+       OSF/1 3.0.
+
+start-sanitize-h8s
+Tue Jun 18 16:04:29 1996  Jeffrey A. Law  <law@rtl.cygnus.com>
+
+       * h8300.h (H8300SMAGIC): Define.
+       (H8300SBADMAG): Define.
+
+end-sanitize-h8s
+Mon Jun 10 11:53:28 1996  Jeffrey A Law  (law@cygnus.com)
+
+       * internal.h (R_BCC_INV, R_JMP_DEL): New relocations for
+       relaxing in the H8/300 series.
+
+Thu May 16 15:49:22 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * sh.h (R_SH_CODE, R_SH_DATA, R_SH_LABEL): Define.
+
 Tue May  7 00:36:39 1996  Jeffrey A Law  (law@cygnus.com)
 
        * internal.h (R_JMPL2): Renamed from R_JMPL_B8 to be
index 13b35f251afdec738cfe8e3e4354ad283b80e334..8c3a646ca23b4048c6bbacf2f81f07d5383c8644 100644 (file)
@@ -24,7 +24,7 @@ struct external_filehdr
 };
 
 #define FILHDR  struct external_filehdr
-#define FILHSZ sizeof (FILHDR)
+#define FILHSZ 20
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
@@ -70,8 +70,8 @@ typedef       struct external_aouthdr
   char  data_start[4];   /* base of data used for this file */
 } AOUTHDR;
 
-#define AOUTSZ (sizeof(AOUTHDR))
-#define AOUTHDRSZ (sizeof(AOUTHDR))
+#define AOUTSZ 28
+#define AOUTHDRSZ 28
 
 /* aouthdr magic numbers */
 #define NMAGIC         0410    /* separate i/d executable */
@@ -101,7 +101,7 @@ struct external_scnhdr
 };
 
 #define        SCNHDR  struct  external_scnhdr
-#define        SCNHSZ  sizeof  (SCNHDR)
+#define        SCNHSZ  40
 
 /*
  * names of "special" sections
@@ -224,7 +224,7 @@ struct external_syment
 };
 
 #define        SYMENT  struct external_syment
-#define        SYMESZ  sizeof(SYMENT)  
+#define        SYMESZ  18
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
diff --git a/include/coff/m68k.h b/include/coff/m68k.h
new file mode 100644 (file)
index 0000000..022f310
--- /dev/null
@@ -0,0 +1,225 @@
+/*** coff information for M68K */
+
+#ifndef GNU_COFF_M68K_H
+#define GNU_COFF_M68K_H 1
+
+/********************** FILE HEADER **********************/
+
+struct external_filehdr {
+       char f_magic[2];        /* magic number                 */
+       char f_nscns[2];        /* number of sections           */
+       char f_timdat[4];       /* time & date stamp            */
+       char f_symptr[4];       /* file pointer to symtab       */
+       char f_nsyms[4];        /* number of symtab entries     */
+       char f_opthdr[2];       /* sizeof(optional hdr)         */
+       char f_flags[2];        /* flags                        */
+};
+
+
+/* Motorola 68000/68008/68010/68020 */
+#define        MC68MAGIC       0520
+#define MC68KWRMAGIC   0520    /* writeable text segments */
+#define        MC68TVMAGIC     0521
+#define MC68KROMAGIC   0521    /* readonly shareable text segments */
+#define MC68KPGMAGIC   0522    /* demand paged text segments */
+#define        M68MAGIC        0210
+#define        M68TVMAGIC      0211
+
+/* this is the magic of the Bull dpx/2 */
+#define MC68KBCSMAGIC  0526
+
+/* This is Lynx's all-platform magic number for executables. */
+
+#define LYNXCOFFMAGIC  0415
+
+#define OMAGIC M68MAGIC
+
+/* This intentionally does not include MC68KBCSMAGIC; it only includes
+   magic numbers which imply that names do not have underscores.  */
+#define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \
+  ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC) && ((x).f_magic!=LYNXCOFFMAGIC) )
+
+/* Magic numbers for the a.out header.  */
+
+#define PAGEMAGICEXECSWAPPED  0407 /* executable (swapped) */
+#define PAGEMAGICPEXECSWAPPED 0410 /* pure executable (swapped) */
+#define PAGEMAGICPEXECTSHLIB  0443 /* pure executable (target shared library) */
+#define PAGEMAGICPEXECPAGED   0413 /* pure executable (paged) */
+
+#define        FILHDR  struct external_filehdr
+#define        FILHSZ  20
+
+
+/********************** AOUT "OPTIONAL HEADER" **********************/
+
+
+typedef struct 
+{
+  char         magic[2];               /* type of file                         */
+  char vstamp[2];              /* version stamp                        */
+  char tsize[4];               /* text size in bytes, padded to FW bdry*/
+  char dsize[4];               /* initialized data "  "                */
+  char bsize[4];               /* uninitialized data "   "             */
+  char entry[4];               /* entry pt.                            */
+  char         text_start[4];          /* base of text used for this file */
+  char         data_start[4];          /* base of data used for this file */
+}
+AOUTHDR;
+
+#define AOUTSZ 28
+#define AOUTHDRSZ 28
+
+
+/********************** SECTION HEADER **********************/
+
+
+struct external_scnhdr {
+       char            s_name[8];      /* section name                 */
+       char            s_paddr[4];     /* physical address, aliased s_nlib */
+       char            s_vaddr[4];     /* virtual address              */
+       char            s_size[4];      /* section size                 */
+       char            s_scnptr[4];    /* file ptr to raw data for section */
+       char            s_relptr[4];    /* file ptr to relocation       */
+       char            s_lnnoptr[4];   /* file ptr to line numbers     */
+       char            s_nreloc[2];    /* number of relocation entries */
+       char            s_nlnno[2];     /* number of line number entries*/
+       char            s_flags[4];     /* flags                        */
+};
+
+/*
+ * names of "special" sections
+ */
+#define _TEXT  ".text"
+#define _DATA  ".data"
+#define _BSS   ".bss"
+#define _COMMENT ".comment"
+
+#define        SCNHDR  struct external_scnhdr
+#define        SCNHSZ  40
+
+
+/********************** LINE NUMBERS **********************/
+
+/* 1 line number entry for every "breakpointable" source line in a section.
+ * Line numbers are grouped on a per function basis; first entry in a function
+ * grouping will have l_lnno = 0 and in place of physical address will be the
+ * symbol table index of the function name.
+ */
+struct external_lineno {
+       union {
+               char l_symndx[4];       /* function name symbol index, iff l_lnno == 0*/
+               char l_paddr[4];        /* (physical) address of line number    */
+       } l_addr;
+       char l_lnno[2]; /* line number          */
+};
+
+
+#define        LINENO  struct external_lineno
+#define        LINESZ  8
+
+
+/********************** SYMBOLS **********************/
+
+#define E_SYMNMLEN     8       /* # characters in a symbol name        */
+#define E_FILNMLEN     14      /* # characters in a file name          */
+#define E_DIMNUM       4       /* # array dimensions in auxiliary entry */
+
+struct external_syment 
+{
+  union {
+    char e_name[E_SYMNMLEN];
+    struct {
+      char e_zeroes[4];
+      char e_offset[4];
+    } e;
+  } e;
+  char e_value[4];
+  char e_scnum[2];
+  char e_type[2];
+  char e_sclass[1];
+  char e_numaux[1];
+};
+
+
+
+#define N_BTMASK       (017)
+#define N_TMASK                (060)
+#define N_BTSHFT       (4)
+#define N_TSHIFT       (2)
+  
+
+union external_auxent {
+       struct {
+               char x_tagndx[4];       /* str, un, or enum tag indx */
+               union {
+                       struct {
+                           char  x_lnno[2]; /* declaration line number */
+                           char  x_size[2]; /* str/union/array size */
+                       } x_lnsz;
+                       char x_fsize[4];        /* size of function */
+               } x_misc;
+               union {
+                       struct {                /* if ISFCN, tag, or .bb */
+                           char x_lnnoptr[4];  /* ptr to fcn line # */
+                           char x_endndx[4];   /* entry ndx past block end */
+                       } x_fcn;
+                       struct {                /* if ISARY, up to 4 dimen. */
+                           char x_dimen[E_DIMNUM][2];
+                       } x_ary;
+               } x_fcnary;
+               char x_tvndx[2];                /* tv index */
+       } x_sym;
+
+       union {
+               char x_fname[E_FILNMLEN];
+               struct {
+                       char x_zeroes[4];
+                       char x_offset[4];
+               } x_n;
+       } x_file;
+
+       struct {
+               char x_scnlen[4];                       /* section length */
+               char x_nreloc[2];       /* # relocation entries */
+               char x_nlinno[2];       /* # line numbers */
+       } x_scn;
+
+        struct {
+               char x_tvfill[4];       /* tv fill value */
+               char x_tvlen[2];        /* length of .tv */
+               char x_tvran[2][2];     /* tv range */
+       } x_tv;         /* info about .tv section (in auxent of symbol .tv)) */
+
+
+};
+
+#define        SYMENT  struct external_syment
+#define        SYMESZ  18      
+#define        AUXENT  union external_auxent
+#define        AUXESZ  18
+
+
+
+/********************** RELOCATION DIRECTIVES **********************/
+
+
+struct external_reloc {
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+#ifdef M68K_COFF_OFFSET
+  char r_offset[4];
+#endif
+
+};
+
+
+#define RELOC struct external_reloc
+
+#ifdef M68K_COFF_OFFSET
+#define RELSZ 14
+#else
+#define RELSZ 10
+#endif
+
+#endif /* GNU_COFF_M68K_H */
diff --git a/include/coff/pe.h b/include/coff/pe.h
new file mode 100644 (file)
index 0000000..6a60348
--- /dev/null
@@ -0,0 +1,168 @@
+/* PE COFF header information */
+
+#ifndef _PE_H
+#define _PE_H
+
+/* NT specific file attributes */
+#define IMAGE_FILE_RELOCS_STRIPPED           0x0001
+#define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
+#define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
+#define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
+#define IMAGE_FILE_32BIT_MACHINE             0x0100
+#define IMAGE_FILE_DEBUG_STRIPPED            0x0200
+#define IMAGE_FILE_SYSTEM                    0x1000
+#define IMAGE_FILE_DLL                       0x2000
+#define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
+
+/* additional flags to be set for section headers to allow the NT loader to
+   read and write to the section data (to replace the addresses of data in
+   dlls for one thing); also to execute the section in .text's case */
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
+#define IMAGE_SCN_MEM_EXECUTE     0x20000000
+#define IMAGE_SCN_MEM_READ        0x40000000
+#define IMAGE_SCN_MEM_WRITE       0x80000000
+
+/*
+ * Section characteristics added for ppc-nt
+ */
+
+#define IMAGE_SCN_TYPE_NO_PAD                0x00000008  /* Reserved. */
+
+#define IMAGE_SCN_CNT_CODE                   0x00000020  /* Section contains code. */
+#define IMAGE_SCN_CNT_INITIALIZED_DATA       0x00000040  /* Section contains initialized data. */
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA     0x00000080  /* Section contains uninitialized data. */
+
+#define IMAGE_SCN_LNK_OTHER                  0x00000100  /* Reserved. */
+#define IMAGE_SCN_LNK_INFO                   0x00000200  /* Section contains comments or some other type of information. */
+#define IMAGE_SCN_LNK_REMOVE                 0x00000800  /* Section contents will not become part of image. */
+#define IMAGE_SCN_LNK_COMDAT                 0x00001000  /* Section contents comdat. */
+
+#define IMAGE_SCN_MEM_FARDATA                0x00008000
+
+#define IMAGE_SCN_MEM_PURGEABLE              0x00020000
+#define IMAGE_SCN_MEM_16BIT                  0x00020000
+#define IMAGE_SCN_MEM_LOCKED                 0x00040000
+#define IMAGE_SCN_MEM_PRELOAD                0x00080000
+
+#define IMAGE_SCN_ALIGN_1BYTES               0x00100000
+#define IMAGE_SCN_ALIGN_2BYTES               0x00200000
+#define IMAGE_SCN_ALIGN_4BYTES               0x00300000
+#define IMAGE_SCN_ALIGN_8BYTES               0x00400000
+#define IMAGE_SCN_ALIGN_16BYTES              0x00500000  /* Default alignment if no others are specified. */
+#define IMAGE_SCN_ALIGN_32BYTES              0x00600000
+#define IMAGE_SCN_ALIGN_64BYTES              0x00700000
+
+
+#define IMAGE_SCN_LNK_NRELOC_OVFL            0x01000000  /* Section contains extended relocations. */
+#define IMAGE_SCN_MEM_NOT_CACHED             0x04000000  /* Section is not cachable.               */
+#define IMAGE_SCN_MEM_NOT_PAGED              0x08000000  /* Section is not pageable.               */
+#define IMAGE_SCN_MEM_SHARED                 0x10000000  /* Section is shareable.                  */
+
+/* COMDAT selection codes.  */
+
+#define IMAGE_COMDAT_SELECT_NODUPLICATES     (1) /* Warn if duplicates.  */
+#define IMAGE_COMDAT_SELECT_ANY                     (2) /* No warning.  */
+#define IMAGE_COMDAT_SELECT_SAME_SIZE       (3) /* Warn if different size.  */
+#define IMAGE_COMDAT_SELECT_EXACT_MATCH             (4) /* Warn if different.  */
+#define IMAGE_COMDAT_SELECT_ASSOCIATIVE             (5) /* Base on other section.  */
+
+/* Magic values that are true for all dos/nt implementations */
+#define DOSMAGIC       0x5a4d  
+#define NT_SIGNATURE   0x00004550
+
+  /* NT allows long filenames, we want to accommodate this.  This may break
+     some of the bfd functions */
+#undef  FILNMLEN
+#define FILNMLEN       18      /* # characters in a file name          */
+
+
+#ifdef COFF_IMAGE_WITH_PE
+/* The filehdr is only weired in images */
+
+#undef FILHDR
+struct external_PE_filehdr
+{
+  /* DOS header fields */
+  char e_magic[2];             /* Magic number, 0x5a4d */
+  char e_cblp[2];              /* Bytes on last page of file, 0x90 */
+  char e_cp[2];                        /* Pages in file, 0x3 */
+  char e_crlc[2];              /* Relocations, 0x0 */
+  char e_cparhdr[2];           /* Size of header in paragraphs, 0x4 */
+  char e_minalloc[2];          /* Minimum extra paragraphs needed, 0x0 */
+  char e_maxalloc[2];          /* Maximum extra paragraphs needed, 0xFFFF */
+  char e_ss[2];                        /* Initial (relative) SS value, 0x0 */
+  char e_sp[2];                        /* Initial SP value, 0xb8 */
+  char e_csum[2];              /* Checksum, 0x0 */
+  char e_ip[2];                        /* Initial IP value, 0x0 */
+  char e_cs[2];                        /* Initial (relative) CS value, 0x0 */
+  char e_lfarlc[2];            /* File address of relocation table, 0x40 */
+  char e_ovno[2];              /* Overlay number, 0x0 */
+  char e_res[4][2];            /* Reserved words, all 0x0 */
+  char e_oemid[2];             /* OEM identifier (for e_oeminfo), 0x0 */
+  char e_oeminfo[2];           /* OEM information; e_oemid specific, 0x0 */
+  char e_res2[10][2];          /* Reserved words, all 0x0 */
+  char e_lfanew[4];            /* File address of new exe header, 0x80 */
+  char dos_message[16][4];     /* other stuff, always follow DOS header */
+  char nt_signature[4];                /* required NT signature, 0x4550 */ 
+
+  /* From standard header */  
+
+
+  char f_magic[2];             /* magic number                 */
+  char f_nscns[2];             /* number of sections           */
+  char f_timdat[4];            /* time & date stamp            */
+  char f_symptr[4];            /* file pointer to symtab       */
+  char f_nsyms[4];             /* number of symtab entries     */
+  char f_opthdr[2];            /* sizeof(optional hdr)         */
+  char f_flags[2];             /* flags                        */
+
+};
+
+
+#define FILHDR struct external_PE_filehdr
+
+
+#endif
+
+typedef struct 
+{
+  AOUTHDR standard;
+
+  /* NT extra fields; see internal.h for descriptions */
+  char  ImageBase[4];
+  char  SectionAlignment[4];
+  char  FileAlignment[4];
+  char  MajorOperatingSystemVersion[2];
+  char  MinorOperatingSystemVersion[2];
+  char  MajorImageVersion[2];
+  char  MinorImageVersion[2];
+  char  MajorSubsystemVersion[2];
+  char  MinorSubsystemVersion[2];
+  char  Reserved1[4];
+  char  SizeOfImage[4];
+  char  SizeOfHeaders[4];
+  char  CheckSum[4];
+  char  Subsystem[2];
+  char  DllCharacteristics[2];
+  char  SizeOfStackReserve[4];
+  char  SizeOfStackCommit[4];
+  char  SizeOfHeapReserve[4];
+  char  SizeOfHeapCommit[4];
+  char  LoaderFlags[4];
+  char  NumberOfRvaAndSizes[4];
+  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
+  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
+
+} PEAOUTHDR;
+
+
+#undef AOUTSZ
+#define AOUTSZ (AOUTHDRSZ + 196)
+
+#undef  E_FILNMLEN
+#define E_FILNMLEN     18      /* # characters in a file name          */
+#endif
+
+
+
This page took 0.029702 seconds and 4 git commands to generate.