Now there are two incarnations of relocs, linenos and syments. One for
authorSteve Chamberlain <steve@cygnus>
Fri, 10 May 1991 19:41:19 +0000 (19:41 +0000)
committerSteve Chamberlain <steve@cygnus>
Fri, 10 May 1991 19:41:19 +0000 (19:41 +0000)
internal digestion, and one full of char arrays for I/O. The original
names have gone to detect errors.

include/coff-i960.h
include/coff-m88k.h

index 2c1877a6aa84fa1d12e06a20c5454da6b848cf86..db21c4b400be2aaf8031ed05a4798fc77c7cfc7c 100755 (executable)
@@ -222,17 +222,25 @@ struct scnhdr {
  * grouping will have l_lnno = 0 and in place of physical address will be the
  * symbol table index of the function name.
  */
  * grouping will have l_lnno = 0 and in place of physical address will be the
  * symbol table index of the function name.
  */
-struct lineno {
+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;
+       unsigned short  l_lnno; /* line number          */
+       char padding[2];        /* force alignment      */
+};
+
+struct internal_lineno {
        union {
                long l_symndx;  /* function name symbol index, iff l_lnno == 0*/
                long l_paddr;   /* (physical) address of line number    */
        } l_addr;
        unsigned short  l_lnno; /* line number          */
        union {
                long l_symndx;  /* function name symbol index, iff l_lnno == 0*/
                long l_paddr;   /* (physical) address of line number    */
        } l_addr;
        unsigned short  l_lnno; /* line number          */
-       char padding[2];        /* force alignment      */
 };
 
 };
 
-#define        LINENO  struct lineno
-#define        LINESZ  sizeof(LINENO) 
+#define        LINENO  struct external_lineno
+#define        LINESZ  8
 
 
 /********************** SYMBOLS **********************/
 
 
 /********************** SYMBOLS **********************/
@@ -241,7 +249,26 @@ struct lineno {
 #define FILNMLEN       14      /* # characters in a file name          */
 #define DIMNUM         4       /* # array dimensions in auxiliary entry */
 
 #define FILNMLEN       14      /* # characters in a file name          */
 #define DIMNUM         4       /* # array dimensions in auxiliary entry */
 
-struct syment {
+struct external_syment 
+{
+  union {
+    char e_name[SYMNMLEN];
+    struct {
+      char e_zeroes[4];
+      char e_offset[4];
+    } e;
+  } e;
+  char e_value[4];
+  char e_scnum[2];
+  char e_flags[2];
+  char e_type[4];
+  char e_sclass[1];
+  char e_numaux[1];
+  char pad2[2];
+};
+
+
+struct internal_syment {
        union {
                char    _n_name[SYMNMLEN];      /* old COFF version     */
                struct {
        union {
                char    _n_name[SYMNMLEN];      /* old COFF version     */
                struct {
@@ -256,14 +283,8 @@ struct syment {
        unsigned long   n_type;         /* type and derived type        */
        char            n_sclass;       /* storage class                */
        char            n_numaux;       /* number of aux. entries       */
        unsigned long   n_type;         /* type and derived type        */
        char            n_sclass;       /* storage class                */
        char            n_numaux;       /* number of aux. entries       */
-       char            pad2[2];        /* force alignment              */
 };
 
 };
 
-#define n_name         _n._n_name
-#define n_ptr          _n._n_nptr[1]
-#define n_zeroes       _n._n_n._n_zeroes
-#define n_offset       _n._n_n._n_offset
-
 /*
  * Relocatable symbols have number of the section in which they are defined,
  * or one of the following:
 /*
  * Relocatable symbols have number of the section in which they are defined,
  * or one of the following:
@@ -315,8 +336,69 @@ struct syment {
 #define ISARY(x)       (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
 
 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
 #define ISARY(x)       (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
 
 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
+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[DIMNUM][2];
+                       } x_ary;
+               } x_fcnary;
+               char x_tvndx[2];                /* tv index */
+       } x_sym;
+
+       union {
+               char x_fname[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)) */
+
+       /******************************************
+        *  I960-specific *2nd* aux. entry formats
+        ******************************************/
+       struct {
+         /* This is a very old typo that keeps getting propagated. */
+#define x_stdindx x_stindx
+               char x_stindx[4];       /* sys. table entry */
+       } x_sc; /* system call entry */
 
 
-union auxent {
+       struct {
+               char x_balntry[4]; /* BAL entry point */
+       } x_bal; /* BAL-callable function */
+
+        struct {
+               char x_timestamp[4];            /* time stamp */
+               char    x_idstring[20];         /* producer identity string */
+       } x_ident;                              /* Producer ident info */
+
+};
+
+union  internal_auxent {
        struct {
                long x_tagndx;  /* str, un, or enum tag indx */
                union {
        struct {
                long x_tagndx;  /* str, un, or enum tag indx */
                union {
@@ -376,27 +458,29 @@ union auxent {
                char    x_idstring[20];         /* producer identity string */
        } x_ident;                              /* Producer ident info */
 
                char    x_idstring[20];         /* producer identity string */
        } x_ident;                              /* Producer ident info */
 
-       char a[sizeof(struct syment)];  /* force auxent/syment sizes to match */
+
 };
 
 };
 
-#define        SYMENT  struct syment
+#define        SYMENT  struct external_syment
 #define        SYMESZ  sizeof(SYMENT)  
 #define        SYMESZ  sizeof(SYMENT)  
-#define        AUXENT  union auxent
+#define        AUXENT  union external_auxent
 #define        AUXESZ  sizeof(AUXENT)
 
 #define        AUXESZ  sizeof(AUXENT)
 
-#if VAX || I960
 #      define _ETEXT   "_etext"
 #      define _ETEXT   "_etext"
-#else
-#      define _ETEXT   "etext"
-#endif
 
 /********************** RELOCATION DIRECTIVES **********************/
 
 
 /********************** RELOCATION DIRECTIVES **********************/
 
-struct reloc {
+struct external_reloc {
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+  char pad[2];
+};
+
+struct internal_reloc {
        long r_vaddr;           /* Virtual address of reference */
        long r_symndx;          /* Index into symbol table      */
        unsigned short r_type;  /* Relocation type              */
        long r_vaddr;           /* Virtual address of reference */
        long r_symndx;          /* Index into symbol table      */
        unsigned short r_type;  /* Relocation type              */
-       char pad[2];            /* Unused                       */
 };
 
 /* Relevent values for r_type and i960.  Would someone please document them */
 };
 
 /* Relevent values for r_type and i960.  Would someone please document them */
@@ -411,8 +495,8 @@ struct reloc {
 #define R_GETPA                (0x1e)
 #define R_TAGWORD      (0x1f)
 
 #define R_GETPA                (0x1e)
 #define R_TAGWORD      (0x1f)
 
-#define RELOC struct reloc
-#define RELSZ sizeof(RELOC)
+#define RELOC struct external_reloc
+#define RELSZ 12
 
 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
 
 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
index 1a1d5d831bc8083de84aaf4e020ed194e5537fbf..64a7a011a4dac606f336b27b7a4335b54020c32a 100755 (executable)
@@ -133,7 +133,16 @@ struct scnhdr {
  * grouping will have l_lnno = 0 and in place of physical address will be the
  * symbol table index of the function name.
  */
  * grouping will have l_lnno = 0 and in place of physical address will be the
  * symbol table index of the function name.
  */
-struct lineno{
+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[4];
+
+};
+struct internal_lineno{
        union {
                long l_symndx;  /* function name symbol index, iff l_lnno == 0*/
                long l_paddr;   /* (physical) address of line number    */
        union {
                long l_symndx;  /* function name symbol index, iff l_lnno == 0*/
                long l_paddr;   /* (physical) address of line number    */
@@ -143,8 +152,8 @@ struct lineno{
 
 };
 
 
 };
 
-#define        LINENO  struct lineno
-#define        LINESZ  sizeof(LINENO) 
+#define        LINENO  struct external_lineno
+#define        LINESZ  8
 
 
 /********************** SYMBOLS **********************/
 
 
 /********************** SYMBOLS **********************/
@@ -153,8 +162,24 @@ struct lineno{
 #define FILNMLEN       14      /* # characters in a file name          */
 #define DIMNUM         4       /* # array dimensions in auxiliary entry */
 
 #define FILNMLEN       14      /* # characters in a file name          */
 #define DIMNUM         4       /* # array dimensions in auxiliary entry */
 
+struct external_syment 
+{
+  union {
+    char e_name[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];
+  char pad2[2];
+};
 
 
-struct syment {
+struct internal_syment {
        union {
                char    _n_name[SYMNMLEN];      /* old COFF version     */
                struct {
        union {
                char    _n_name[SYMNMLEN];      /* old COFF version     */
                struct {
@@ -168,12 +193,8 @@ struct syment {
        unsigned short  n_type;         /* type and derived type        */
        char            n_sclass;       /* storage class                */
        char            n_numaux;       /* number of aux. entries       */
        unsigned short  n_type;         /* type and derived type        */
        char            n_sclass;       /* storage class                */
        char            n_numaux;       /* number of aux. entries       */
-       char            pad2[2];        /* force alignment              */
-};
 
 
-#define n_name         _n._n_name
-#define n_zeroes       _n._n_n._n_zeroes
-#define n_offset       _n._n_n._n_offset
+};
 
 /*
  * Relocatable symbols have number of the section in which they are defined,
 
 /*
  * Relocatable symbols have number of the section in which they are defined,
@@ -227,58 +248,114 @@ struct syment {
 
 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
 
 
 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
 
-union auxent {
+union external_auxent {
        struct {
        struct {
-               long x_tagndx;  /* str, un, or enum tag indx */
+               char x_tagndx[4];       /* str, un, or enum tag indx */
                union {
                        struct {
                union {
                        struct {
-                           unsigned long x_lnno; /* declaration line number */
-                           unsigned long x_size; /* str/union/array size */
+                           char  x_lnno[2]; /* declaration line number */
+                           char  x_size[2]; /* str/union/array size */
                        } x_lnsz;
                        } x_lnsz;
-                       long x_fsize;   /* size of function */
+                       char x_fsize[4];        /* size of function */
                } x_misc;
                union {
                        struct {                /* if ISFCN, tag, or .bb */
                } x_misc;
                union {
                        struct {                /* if ISFCN, tag, or .bb */
-                           long x_lnnoptr;     /* ptr to fcn line # */
-                           long x_endndx;      /* entry ndx past block end */
+                           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. */
                        } x_fcn;
                        struct {                /* if ISARY, up to 4 dimen. */
-                           unsigned short x_dimen[DIMNUM];
+                           char x_dimen[DIMNUM][2];
                        } x_ary;
                } x_fcnary;
                        } x_ary;
                } x_fcnary;
-               unsigned short x_tvndx;         /* tv index */
+               char x_tvndx[2];                /* tv index */
        } x_sym;
 
        union {
                char x_fname[FILNMLEN];
                struct {
        } x_sym;
 
        union {
                char x_fname[FILNMLEN];
                struct {
-                       long x_zeroes;
-                       long x_offset;
+                       char x_zeroes[4];
+                       char x_offset[4];
                } x_n;
        } x_file;
 
        struct {
                } x_n;
        } x_file;
 
        struct {
-               long x_scnlen;                  /* section length */
-               unsigned long x_nreloc; /* # relocation entries */
-               unsigned long x_nlinno; /* # line numbers */
+               char x_scnlen[4];                       /* section length */
+               char x_nreloc[2];       /* # relocation entries */
+               char x_nlinno[2];       /* # line numbers */
        } x_scn;
 
        } 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)) */
+
 
 };
 
 };
+union  internal_auxent 
+{
+  struct {
+    long x_tagndx;             /* str, un, or enum tag indx */
+    union {
+      struct {
+       unsigned short x_lnno;  /* declaration line number */
+       unsigned short x_size;  /* str/union/array size */
+      } x_lnsz;
+      long x_fsize;            /* size of function */
+    } x_misc;
+    union {
+      struct {                 /* if ISFCN, tag, or .bb */
+       long x_lnnoptr;         /* ptr to fcn line # */
+       long x_endndx;          /* entry ndx past block end */
+      } x_fcn;
+      struct {                 /* if ISARY, up to 4 dimen. */
+       unsigned short x_dimen[DIMNUM];
+      } x_ary;
+    } x_fcnary;
+    unsigned short x_tvndx;    /* tv index */
+  } x_sym;
+  
+  union {
+    char x_fname[FILNMLEN];
+    struct {
+      long x_zeroes;
+      long x_offset;
+    } x_n;
+  } x_file;
+  
+  struct {
+    long x_scnlen;             /* section length */
+    unsigned short x_nreloc;   /* # relocation entries */
+    unsigned short x_nlinno;   /* # line numbers */
+  } x_scn;
+  
+  struct {
+    long               x_tvfill; /* tv fill value */
+    unsigned short     x_tvlen; /* length of .tv */
+    unsigned short     x_tvran[2]; /* tv range */
+  } x_tv;                      /* info about .tv section (in auxent of symbol .tv)) */
+};
 
 
-#define        SYMENT  struct syment
+#define        SYMENT  struct external_syment
 #define        SYMESZ  20
 #define        SYMESZ  20
-#define        AUXENT  union auxent
+#define        AUXENT  union external_auxent
 #define        AUXESZ  20
 
 
 /********************** RELOCATION DIRECTIVES **********************/
 
 #define        AUXESZ  20
 
 
 /********************** RELOCATION DIRECTIVES **********************/
 
-struct reloc {
-       long r_vaddr;           /* Virtual address of reference */
-       long r_symndx;          /* Index into symbol table      */
-       unsigned short r_type;  /* Relocation type              */
-       unsigned short r_offset;/* Hi 16 bits of constant       */
+struct external_reloc {
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+  char r_offset[2];
+};
+
+struct internal_reloc {
+  long r_vaddr;                /* Virtual address of reference */
+  long r_symndx;       /* Index into symbol table      */
+  unsigned short r_type; /* Relocation type            */
+  unsigned short r_offset; /* Hi 16 bits of constant       */
 };
 
 /* Only values of r_type GNU/88k cares about */
 };
 
 /* Only values of r_type GNU/88k cares about */
@@ -292,7 +369,7 @@ struct reloc {
 
 
 
 
 
 
-#define RELOC struct reloc
-#define RELSZ sizeof(RELOC)
+#define RELOC struct external_reloc
+#define RELSZ  12
 
 #define DEFAULT_SECTION_ALIGNMENT 8 /* double word */
 
 #define DEFAULT_SECTION_ALIGNMENT 8 /* double word */
This page took 0.054513 seconds and 4 git commands to generate.