Revert 'Remove unused struct serial::name field'
[deliverable/binutils-gdb.git] / include / coff / ecoff.h
index 249775e5e8fff5213f6b087a9fd4b41307439f8a..e80aa1bc8b9981a2ef6bf263a8f62c2e9edb6b45 100644 (file)
@@ -1,9 +1,28 @@
+/* Generic ECOFF support.
+   This does not include symbol information, found in sym.h and
+   symconst.h.
+
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
 #ifndef ECOFF_H
 #define ECOFF_H
 
-/* Generic ECOFF support.
-   This does not include symbol information, found in sym.h and
-   symconst.h.  */
+#include "coff/sym.h"
 
 /* Mips magic numbers used in filehdr.  MIPS_MAGIC_LITTLE is used on
    little endian machines.  MIPS_MAGIC_BIG is used on big endian
@@ -24,6 +43,9 @@
 
 /* Alpha magic numbers used in filehdr.  */
 #define ALPHA_MAGIC 0x183
+#define ALPHA_MAGIC_BSD 0x185
+/* A compressed version of an ALPHA_MAGIC file created by DEC's tools.  */
+#define ALPHA_MAGIC_COMPRESSED 0x188
 
 /* Magic numbers used in a.out header.  */
 #define ECOFF_AOUT_OMAGIC 0407 /* not demand paged (ld -N).  */
 #define _FINI  ".fini"
 #define _PDATA ".pdata"
 #define _XDATA ".xdata"
+#define _GOT   ".got"
+#define _HASH  ".hash"
+#define _DYNSYM        ".dynsym"
+#define _DYNSTR        ".dynstr"
+#define _RELDYN        ".rel.dyn"
+#define _CONFLIC ".conflic"
+#define _COMMENT ".comment"
+#define _LIBLIST ".liblist"
+#define _DYNAMIC ".dynamic"
+#define _RCONST        ".rconst"
 
 /* ECOFF uses some additional section flags.  */
 #define STYP_RDATA          0x100
 #define STYP_SDATA          0x200
 #define STYP_SBSS           0x400
+#define STYP_GOT           0x1000
+#define STYP_DYNAMIC       0x2000
+#define STYP_DYNSYM        0x4000
+#define STYP_RELDYN        0x8000
+#define STYP_DYNSTR       0x10000
+#define STYP_HASH         0x20000
+#define STYP_LIBLIST      0x40000
+#define STYP_CONFLIC     0x100000
 #define STYP_ECOFF_FINI         0x1000000
 #define STYP_EXTENDESC  0x2000000 /* 0x02FFF000 bits => scn type, rest clr */
 #define STYP_LITA       0x4000000
 
 /* extended section types */
 #define STYP_COMMENT    0x2100000
+#define STYP_RCONST     0x2200000
 #define STYP_XDATA      0x2400000
 #define STYP_PDATA      0x2800000
 
    writing it out.  */
 #define SCOMMON ".scommon"
 
-/* The ECOFF a.out header carries information about register masks and
-   the gp value.  The assembler needs to be able to write out this
-   information, and objcopy needs to be able to copy it from one file
-   to another.  To handle this in BFD, we use a dummy section to hold
-   the information.  We call this section .reginfo, since MIPS ELF has
-   a .reginfo section which serves a similar purpose.  When BFD
-   recognizes an ECOFF object, it copies the information into a
-   private data structure.  When the .reginfo section is read, the
-   information is retrieved from the private data structure.  When the
-   .reginfo section is written, the information in the private data
-   structure is updated.  The contents of the .reginfo section, as
-   seen by programs outside BFD, is a ecoff_reginfo structure.  The
-   contents of the structure are as seen on the host, so no swapping
-   issues arise.
-
-   The assembler used to update the private BFD data structures
-   directly.  With this approach, it instead just creates a .reginfo
-   section and updates that.  The real advantage of this approach is
-   that objcopy works automatically.  */
-#define REGINFO ".reginfo"
-struct ecoff_reginfo
-{
-  bfd_vma gp_value;            /* GP register value.           */
-  unsigned long gprmask;       /* General registers used.      */
-  unsigned long cprmask[4];    /* Coprocessor registers used.  */
-  unsigned long fprmask;       /* Floating pointer registers used.  */
-};  
-
 /* If the extern bit in a reloc is 1, then r_symndx is an index into
    the external symbol table.  If the extern bit is 0, then r_symndx
    indicates a section, and is one of the following values.  */
@@ -115,8 +128,9 @@ struct ecoff_reginfo
 #define RELOC_SECTION_FINI     12
 #define RELOC_SECTION_LITA     13
 #define RELOC_SECTION_ABS      14
+#define RELOC_SECTION_RCONST   15
 
-#define NUM_RELOC_SECTIONS     15
+#define NUM_RELOC_SECTIONS     16
 
 /********************** STABS **********************/
 
@@ -262,62 +276,6 @@ union aux_ext {
 #define AUX_PUT_COUNT(bigend, val, ax) \
   AUX_PUT_ANY ((bigend), (val), (ax), a_count)
 
-/* Prototypes for the swapping functions.  These require that sym.h be
-   included before this file.  */
-
-extern void ecoff_swap_tir_in PARAMS ((int bigend, struct tir_ext *, TIR *));
-extern void ecoff_swap_tir_out PARAMS ((int bigend, TIR *, struct tir_ext *));
-extern void ecoff_swap_rndx_in PARAMS ((int bigend, struct rndx_ext *,
-                                       RNDXR *));
-extern void ecoff_swap_rndx_out PARAMS ((int bigend, RNDXR *,
-                                        struct rndx_ext *));
-
-/********************** SWAPPING **********************/
-
-/* The generic ECOFF code needs to be able to swap debugging
-   information in and out in the specific format used by a particular
-   ECOFF implementation.  This structure provides the information
-   needed to do this.  */
-
-struct ecoff_debug_swap
-{
-  /* Symbol table magic number.  */
-  int sym_magic;
-  /* Alignment of debugging information.  E.g., 4.  */
-  bfd_size_type debug_align;
-  /* Sizes of external symbolic information.  */
-  bfd_size_type external_hdr_size;
-  bfd_size_type external_dnr_size;
-  bfd_size_type external_pdr_size;
-  bfd_size_type external_sym_size;
-  bfd_size_type external_opt_size;
-  bfd_size_type external_fdr_size;
-  bfd_size_type external_rfd_size;
-  bfd_size_type external_ext_size;
-  /* Functions to swap in external symbolic data.  */
-  void (*swap_hdr_in) PARAMS ((bfd *, PTR, HDRR *));
-  void (*swap_dnr_in) PARAMS ((bfd *, PTR, DNR *));
-  void (*swap_pdr_in) PARAMS ((bfd *, PTR, PDR *));
-  void (*swap_sym_in) PARAMS ((bfd *, PTR, SYMR *));
-  void (*swap_opt_in) PARAMS ((bfd *, PTR, OPTR *));
-  void (*swap_fdr_in) PARAMS ((bfd *, PTR, FDR *));
-  void (*swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *));
-  void (*swap_ext_in) PARAMS ((bfd *, PTR, EXTR *));
-  /* Functions to swap out external symbolic data.  */
-  void (*swap_hdr_out) PARAMS ((bfd *, const HDRR *, PTR));
-  void (*swap_dnr_out) PARAMS ((bfd *, const DNR *, PTR));
-  void (*swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR));
-  void (*swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR));
-  void (*swap_opt_out) PARAMS ((bfd *, const OPTR *, PTR));
-  void (*swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR));
-  void (*swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR));
-  void (*swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR));
-  /* As noted above, it so happens that the auxiliary type information
-   has the same type and format for all known ECOFF targets.  I don't
-   see any reason that that should change, so at least for now the
-   auxiliary swapping information is not in this table.  */
-};
-
 /********************** SYMBOLS **********************/
 
 /* For efficiency, gdb deals directly with the unswapped symbolic
@@ -343,21 +301,21 @@ struct ecoff_debug_info
      fields are also used by the assembler to output ECOFF debugging
      information.  */
   unsigned char *line;
-  PTR external_dnr;    /* struct dnr_ext */
-  PTR external_pdr;    /* struct pdr_ext */
-  PTR external_sym;    /* struct sym_ext */
-  PTR external_opt;    /* struct opt_ext */
+  void *external_dnr;  /* struct dnr_ext */
+  void *external_pdr;  /* struct pdr_ext */
+  void *external_sym;  /* struct sym_ext */
+  void *external_opt;  /* struct opt_ext */
   union aux_ext *external_aux;
   char *ss;
   char *ssext;
-  PTR external_fdr;    /* struct fdr_ext */
-  PTR external_rfd;    /* struct rfd_ext */
-  PTR external_ext;    /* struct ext_ext */
+  void *external_fdr;  /* struct fdr_ext */
+  void *external_rfd;  /* struct rfd_ext */
+  void *external_ext;  /* struct ext_ext */
 
   /* These fields are used when linking.  They may disappear at some
      point.  */
   char *ssext_end;
-  PTR external_ext_end;
+  void *external_ext_end;
 
   /* When linking, this field holds a mapping from the input FDR
      numbers to the output numbers, and is used when writing out the
@@ -369,34 +327,87 @@ struct ecoff_debug_info
      this changes in the future.  This is a pointer to an array, not a
      single structure.  */
   FDR *fdr;
+};
+
+/* These structures are used by the ECOFF find_nearest_line function.  */
 
-  /* When relaxing MIPS embedded PIC code, we may need to adjust
-     symbol values when they are output.  This is a linked list of
-     structures indicating how values should be adjusted.  There is no
-     requirement that the entries be in any order, or that they not
-     overlap.  This field is normally NULL, in which case no
-     adjustments need to be made.  */
-  struct ecoff_value_adjust *adjust;
+struct ecoff_fdrtab_entry
+{
+  /* Base address in .text of this FDR.  */
+  bfd_vma base_addr;
+  FDR *fdr;
 };
 
-/* This structure describes how to adjust symbol values when
-   outputting MIPS embedded PIC code.  These adjustments only apply to
-   the internal symbols, as the external symbol values will come from
-   the hash table and have already been adjusted.  */
+struct ecoff_find_line
+{
+  /* Allocated memory to hold function and file names.  */
+  char *find_buffer;
+
+  /* FDR table, sorted by address: */
+  long fdrtab_len;
+  struct ecoff_fdrtab_entry *fdrtab;
+
+  /* Cache entry for most recently found line information.  The sect
+     field is NULL if this cache does not contain valid information.  */
+  struct
+    {
+      asection *sect;
+      bfd_vma start;
+      bfd_vma stop;
+      const char *filename;
+      const char *functionname;
+      unsigned int line_num;
+    } cache;
+};
+
+/********************** SWAPPING **********************/
+
+/* The generic ECOFF code needs to be able to swap debugging
+   information in and out in the specific format used by a particular
+   ECOFF implementation.  This structure provides the information
+   needed to do this.  */
 
-struct ecoff_value_adjust
+struct ecoff_debug_swap
 {
-  /* Next entry on adjustment list.  */
-  struct ecoff_value_adjust *next;
-  /* Starting VMA of adjustment.  This is the VMA in the ECOFF file,
-     not the offset from the start of the section.  Thus it should
-     indicate a particular section.  */
-  bfd_vma start;
-  /* Ending VMA of adjustment.  */
-  bfd_vma end;
-  /* Adjustment.  This should be added to the value of the symbol, or
-     FDR.  This is zero for the last entry in the array.  */
-  long adjust;
+  /* Symbol table magic number.  */
+  int sym_magic;
+  /* Alignment of debugging information.  E.g., 4.  */
+  bfd_size_type debug_align;
+  /* Sizes of external symbolic information.  */
+  bfd_size_type external_hdr_size;
+  bfd_size_type external_dnr_size;
+  bfd_size_type external_pdr_size;
+  bfd_size_type external_sym_size;
+  bfd_size_type external_opt_size;
+  bfd_size_type external_fdr_size;
+  bfd_size_type external_rfd_size;
+  bfd_size_type external_ext_size;
+  /* Functions to swap in external symbolic data.  */
+  void (*swap_hdr_in) (bfd *, void *, HDRR *);
+  void (*swap_dnr_in) (bfd *, void *, DNR *);
+  void (*swap_pdr_in) (bfd *, void *, PDR *);
+  void (*swap_sym_in) (bfd *, void *, SYMR *);
+  void (*swap_opt_in) (bfd *, void *, OPTR *);
+  void (*swap_fdr_in) (bfd *, void *, FDR *);
+  void (*swap_rfd_in) (bfd *, void *, RFDT *);
+  void (*swap_ext_in) (bfd *, void *, EXTR *);
+  void (*swap_tir_in) (int, const struct tir_ext *, TIR *);
+  void (*swap_rndx_in) (int, const struct rndx_ext *, RNDXR *);
+  /* Functions to swap out external symbolic data.  */
+  void (*swap_hdr_out) (bfd *, const HDRR *, void *);
+  void (*swap_dnr_out) (bfd *, const DNR *, void *);
+  void (*swap_pdr_out) (bfd *, const PDR *, void *);
+  void (*swap_sym_out) (bfd *, const SYMR *, void *);
+  void (*swap_opt_out) (bfd *, const OPTR *, void *);
+  void (*swap_fdr_out) (bfd *, const FDR *, void *);
+  void (*swap_rfd_out) (bfd *, const RFDT *, void *);
+  void (*swap_ext_out) (bfd *, const EXTR *, void *);
+  void (*swap_tir_out) (int, const TIR *, struct tir_ext *);
+  void (*swap_rndx_out) (int, const RNDXR *, struct rndx_ext *);
+  /* Function to read symbol data and set up pointers in
+     ecoff_debug_info structure.  The section argument is used for
+     ELF, not straight ECOFF.  */
+  bfd_boolean (*read_debug_info) (bfd *, asection *, struct ecoff_debug_info *);
 };
 
 #endif /* ! defined (ECOFF_H) */
This page took 0.027751 seconds and 4 git commands to generate.