#define MIPS_MAGIC_LITTLE 0x0162
#define MIPS_MAGIC_BIG 0x0160
+/* These are the magic numbers used for MIPS code compiled at ISA
+ level 2. */
+#define MIPS_MAGIC_LITTLE2 0x0166
+#define MIPS_MAGIC_BIG2 0x0163
+
+/* These are the magic numbers used for MIPS code compiled at ISA
+ level 3. */
+#define MIPS_MAGIC_LITTLE3 0x142
+#define MIPS_MAGIC_BIG3 0x140
+
/* Alpha magic numbers used in filehdr. */
#define ALPHA_MAGIC 0x183
#define _RDATA ".rdata"
#define _SDATA ".sdata"
#define _SBSS ".sbss"
+#define _LITA ".lita"
#define _LIT4 ".lit4"
#define _LIT8 ".lit8"
#define _LIB ".lib"
#define _INIT ".init"
+#define _FINI ".fini"
+#define _PDATA ".pdata"
+#define _XDATA ".xdata"
/* ECOFF uses some additional section flags. */
#define STYP_RDATA 0x100
#define STYP_SDATA 0x200
#define STYP_SBSS 0x400
+#define STYP_ECOFF_FINI 0x1000000
+#define STYP_LITA 0x4000000
#define STYP_LIT8 0x8000000
#define STYP_LIT4 0x10000000
#define STYP_ECOFF_INIT 0x80000000
-#define STYP_OTHER_LOAD STYP_ECOFF_INIT
+#define STYP_OTHER_LOAD (STYP_ECOFF_INIT | STYP_ECOFF_FINI)
/* The linker needs a section to hold small common variables while
linking. There is no convenient way to create it when the linker
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. */
#define AUX_PUT_ANY(bigend, val, ax, field) \
((bigend) \
- ? (bfd_putb32 ((val), (ax)->field), 0) \
- : (bfd_putl32 ((val), (ax)->field), 0))
+ ? (bfd_putb32 ((bfd_vma) (val), (ax)->field), 0) \
+ : (bfd_putl32 ((bfd_vma) (val), (ax)->field), 0))
#define AUX_PUT_DNLOW(bigend, val, ax) \
AUX_PUT_ANY ((bigend), (val), (ax), a_dnLow)
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
+ information (that way it only takes the time to swap information
+ that it really needs to read). gdb originally retrieved the
+ information directly from the BFD backend information, but that
+ strategy, besides being sort of ugly, does not work for MIPS ELF,
+ which also uses ECOFF debugging information. This structure holds
+ pointers to the (mostly) unswapped symbolic information. */
+
+struct ecoff_debug_info
+{
+ /* The swapped ECOFF symbolic header. */
+ HDRR symbolic_header;
+
+ /* Pointers to the unswapped symbolic information. Note that the
+ pointers to external structures point to different sorts of
+ information on different ECOFF targets. The ecoff_debug_swap
+ structure provides the sizes of the structures and the functions
+ needed to swap the information in and out. These pointers are
+ all pointers to arrays, not single structures. They will be NULL
+ if there are no instances of the relevant structure. */
+ 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 */
+ 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 */
+
+ /* The swapped FDR information. Currently this is never NULL, but
+ code using this structure should probably double-check in case
+ this changes in the future. This is a pointer to an array, not a
+ single structure. */
+ FDR *fdr;
+};
+
#endif /* ! defined (ECOFF_H) */