asection *section,
arelent **relptr,
asymbol **symbols));
+static CONST struct reloc_howto_struct *ecoff_bfd_reloc_type_lookup
+ PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static boolean ecoff_find_nearest_line PARAMS ((bfd *abfd,
asection *section,
asymbol **symbols,
false) /* pcrel_offset */
};
+#define ECOFF_HOWTO_COUNT \
+ (sizeof ecoff_howto_table / sizeof ecoff_howto_table[0])
+
/* Read in the relocs for a section. */
static boolean
return section->reloc_count;
}
+
+/* Get the howto structure for a generic reloc type. */
+
+static CONST struct reloc_howto_struct *
+ecoff_bfd_reloc_type_lookup (abfd, code)
+ bfd *abfd;
+ bfd_reloc_code_real_type code;
+{
+ int ecoff_type;
+
+ switch (code)
+ {
+ case BFD_RELOC_16:
+ ecoff_type = ECOFF_R_REFHALF;
+ break;
+ case BFD_RELOC_32:
+ ecoff_type = ECOFF_R_REFWORD;
+ break;
+ case BFD_RELOC_MIPS_JMP:
+ ecoff_type = ECOFF_R_JMPADDR;
+ break;
+ case BFD_RELOC_HI16_S:
+ ecoff_type = ECOFF_R_REFHI;
+ break;
+ case BFD_RELOC_LO16:
+ ecoff_type = ECOFF_R_REFLO;
+ break;
+ default:
+ return (CONST struct reloc_howto_struct *) NULL;
+ }
+
+ return &ecoff_howto_table[ecoff_type];
+}
\f
/* Provided a BFD, a section and an offset into the section, calculate
and return the name of the source file and the line nearest to the
reloc = *reloc_ptr_ptr;
sym = *reloc->sym_ptr_ptr;
+ /* This must be an ECOFF reloc. */
+ BFD_ASSERT (reloc->howto != (reloc_howto_type *) NULL
+ && reloc->howto >= ecoff_howto_table
+ && (reloc->howto
+ < (ecoff_howto_table + ECOFF_HOWTO_COUNT)));
+
in.r_vaddr = reloc->address + bfd_get_section_vma (abfd, current);
in.r_type = reloc->howto->type;
+
+ /* If this is a REFHI reloc, the next one must be a REFLO
+ reloc for the same symbol. */
+ BFD_ASSERT (in.r_type != ECOFF_R_REFHI
+ || (reloc_ptr_ptr < reloc_end
+ && (reloc_ptr_ptr[1]->howto
+ != (reloc_howto_type *) NULL)
+ && (reloc_ptr_ptr[1]->howto->type
+ == ECOFF_R_REFLO)
+ && (sym == *reloc_ptr_ptr[1]->sym_ptr_ptr)));
+
if ((sym->flags & BSF_SECTION_SYM) == 0)
{
in.r_symndx = ecoff_get_sym_index (*reloc->sym_ptr_ptr);
#define ecoff_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#define ecoff_bfd_relax_section bfd_generic_relax_section
+#define ecoff_bfd_make_debug_symbol \
+ ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
bfd_target ecoff_little_vec =
{
{bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
JUMP_TABLE (ecoff),
- 0, 0,
(PTR) &bfd_ecoff_std_swap_table
};
{bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
JUMP_TABLE(ecoff),
- 0, 0,
(PTR) &bfd_ecoff_std_swap_table
/* Note that there is another bfd_target just above this one. If
you are adding initializers here, you should be adding them there
/* Swap in the symbolic header. */
void
-DEFUN (ecoff_swap_hdr_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct hdr_ext *ext_copy AND
- HDRR *intern)
+ecoff_swap_hdr_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct hdr_ext *ext_copy;
+ HDRR *intern;
{
struct hdr_ext ext[1];
/* Swap out the symbolic header. */
void
-DEFUN (ecoff_swap_hdr_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- HDRR *intern_copy AND
- struct hdr_ext *ext)
+ecoff_swap_hdr_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ HDRR *intern_copy;
+ struct hdr_ext *ext;
{
HDRR intern[1];
/* Swap in the file descriptor record. */
void
-DEFUN (ecoff_swap_fdr_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct fdr_ext *ext_copy AND
- FDR *intern)
+ecoff_swap_fdr_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct fdr_ext *ext_copy;
+ FDR *intern;
{
struct fdr_ext ext[1];
/* Swap out the file descriptor record. */
void
-DEFUN (ecoff_swap_fdr_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- FDR *intern_copy AND
- struct fdr_ext *ext)
+ecoff_swap_fdr_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ FDR *intern_copy;
+ struct fdr_ext *ext;
{
FDR intern[1];
/* Swap in the procedure descriptor record. */
void
-DEFUN (ecoff_swap_pdr_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct pdr_ext *ext_copy AND
- PDR *intern)
+ecoff_swap_pdr_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct pdr_ext *ext_copy;
+ PDR *intern;
{
struct pdr_ext ext[1];
/* Swap out the procedure descriptor record. */
void
-DEFUN (ecoff_swap_pdr_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- PDR *intern_copy AND
- struct pdr_ext *ext)
+ecoff_swap_pdr_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ PDR *intern_copy;
+ struct pdr_ext *ext;
{
PDR intern[1];
/* Swap in a symbol record. */
void
-DEFUN (ecoff_swap_sym_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct sym_ext *ext_copy AND
- SYMR *intern)
+ecoff_swap_sym_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct sym_ext *ext_copy;
+ SYMR *intern;
{
struct sym_ext ext[1];
/* Swap out a symbol record. */
void
-DEFUN (ecoff_swap_sym_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- SYMR *intern_copy AND
- struct sym_ext *ext)
+ecoff_swap_sym_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ SYMR *intern_copy;
+ struct sym_ext *ext;
{
SYMR intern[1];
/* Swap in an external symbol record. */
void
-DEFUN (ecoff_swap_ext_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct ext_ext *ext_copy AND
- EXTR *intern)
+ecoff_swap_ext_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct ext_ext *ext_copy;
+ EXTR *intern;
{
struct ext_ext ext[1];
/* Swap out an external symbol record. */
void
-DEFUN (ecoff_swap_ext_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- EXTR *intern_copy AND
- struct ext_ext *ext)
+ecoff_swap_ext_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ EXTR *intern_copy;
+ struct ext_ext *ext;
{
EXTR intern[1];
info comes from the file header record (fh-fBigendian). */
void
-DEFUN (ecoff_swap_tir_in, (bigend, ext_copy, intern),
- int bigend AND
- struct tir_ext *ext_copy AND
- TIR *intern)
+ecoff_swap_tir_in (bigend, ext_copy, intern)
+ int bigend;
+ struct tir_ext *ext_copy;
+ TIR *intern;
{
struct tir_ext ext[1];
#endif
}
+/* Swap out a type information record.
+ BIGEND says whether AUX symbols are big-endian or little-endian; this
+ info comes from the file header record (fh-fBigendian). */
+
+void
+ecoff_swap_tir_out (bigend, intern_copy, ext)
+ int bigend;
+ TIR *intern_copy;
+ struct tir_ext *ext;
+{
+ TIR intern[1];
+
+ *intern = *intern_copy; /* Make it reasonable to do in-place. */
+
+ /* now the fun stuff... */
+ if (bigend) {
+ ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_BIG : 0)
+ | (intern->continued ? TIR_BITS1_CONTINUED_BIG : 0)
+ | ((intern->bt << TIR_BITS1_BT_SH_BIG)
+ & TIR_BITS1_BT_BIG));
+ ext->t_tq45[0] = (((intern->tq4 << TIR_BITS_TQ4_SH_BIG)
+ & TIR_BITS_TQ4_BIG)
+ | ((intern->tq5 << TIR_BITS_TQ5_SH_BIG)
+ & TIR_BITS_TQ5_BIG));
+ ext->t_tq01[0] = (((intern->tq0 << TIR_BITS_TQ0_SH_BIG)
+ & TIR_BITS_TQ0_BIG)
+ | ((intern->tq1 << TIR_BITS_TQ1_SH_BIG)
+ & TIR_BITS_TQ1_BIG));
+ ext->t_tq23[0] = (((intern->tq2 << TIR_BITS_TQ2_SH_BIG)
+ & TIR_BITS_TQ2_BIG)
+ | ((intern->tq3 << TIR_BITS_TQ3_SH_BIG)
+ & TIR_BITS_TQ3_BIG));
+ } else {
+ ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_LITTLE : 0)
+ | (intern->continued ? TIR_BITS1_CONTINUED_LITTLE : 0)
+ | ((intern->bt << TIR_BITS1_BT_SH_LITTLE)
+ & TIR_BITS1_BT_LITTLE));
+ ext->t_tq45[0] = (((intern->tq4 << TIR_BITS_TQ4_SH_LITTLE)
+ & TIR_BITS_TQ4_LITTLE)
+ | ((intern->tq5 << TIR_BITS_TQ5_SH_LITTLE)
+ & TIR_BITS_TQ5_LITTLE));
+ ext->t_tq01[0] = (((intern->tq0 << TIR_BITS_TQ0_SH_LITTLE)
+ & TIR_BITS_TQ0_LITTLE)
+ | ((intern->tq1 << TIR_BITS_TQ1_SH_LITTLE)
+ & TIR_BITS_TQ1_LITTLE));
+ ext->t_tq23[0] = (((intern->tq2 << TIR_BITS_TQ2_SH_LITTLE)
+ & TIR_BITS_TQ2_LITTLE)
+ | ((intern->tq3 << TIR_BITS_TQ3_SH_LITTLE)
+ & TIR_BITS_TQ3_LITTLE));
+ }
+
+#ifdef TEST
+ if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ abort();
+#endif
+}
+
/* Swap in a relative symbol record. BIGEND says whether it is in
big-endian or little-endian format.*/
void
-DEFUN (ecoff_swap_rndx_in, (bigend, ext_copy, intern),
- int bigend AND
- struct rndx_ext *ext_copy AND
- RNDXR *intern)
+ecoff_swap_rndx_in (bigend, ext_copy, intern)
+ int bigend;
+ struct rndx_ext *ext_copy;
+ RNDXR *intern;
{
struct rndx_ext ext[1];
big-endian or little-endian format.*/
void
-DEFUN (ecoff_swap_rndx_out, (bigend, intern_copy, ext),
- int bigend AND
- RNDXR *intern_copy AND
- struct rndx_ext *ext)
+ecoff_swap_rndx_out (bigend, intern_copy, ext)
+ int bigend;
+ RNDXR *intern_copy;
+ struct rndx_ext *ext;
{
RNDXR intern[1];
/* Swap in a relative file descriptor. */
void
-DEFUN (ecoff_swap_rfd_in, (abfd, ext, intern),
- bfd *abfd AND
- struct rfd_ext *ext AND
- RFDT *intern)
+ecoff_swap_rfd_in (abfd, ext, intern)
+ bfd *abfd;
+ struct rfd_ext *ext;
+ RFDT *intern;
{
*intern = bfd_h_get_32 (abfd, (bfd_byte *)ext->rfd);
/* Swap out a relative file descriptor. */
void
-DEFUN (ecoff_swap_rfd_out, (abfd, intern, ext),
- bfd *abfd AND
- RFDT *intern AND
- struct rfd_ext *ext)
+ecoff_swap_rfd_out (abfd, intern, ext)
+ bfd *abfd;
+ RFDT *intern;
+ struct rfd_ext *ext;
{
bfd_h_put_32 (abfd, *intern, (bfd_byte *)ext->rfd);
/* Swap in an optimization symbol. */
void
-DEFUN (ecoff_swap_opt_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct opt_ext *ext_copy AND
- OPTR *intern)
+ecoff_swap_opt_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct opt_ext *ext_copy;
+ OPTR *intern;
{
struct opt_ext ext[1];
/* Swap out an optimization symbol. */
void
-DEFUN (ecoff_swap_opt_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- OPTR *intern_copy AND
- struct opt_ext *ext)
+ecoff_swap_opt_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ OPTR *intern_copy;
+ struct opt_ext *ext;
{
OPTR intern[1];
/* Swap in a dense number. */
void
-DEFUN (ecoff_swap_dnr_in, (abfd, ext_copy, intern),
- bfd *abfd AND
- struct dnr_ext *ext_copy AND
- DNR *intern)
+ecoff_swap_dnr_in (abfd, ext_copy, intern)
+ bfd *abfd;
+ struct dnr_ext *ext_copy;
+ DNR *intern;
{
struct dnr_ext ext[1];
/* Swap out a dense number. */
void
-DEFUN (ecoff_swap_dnr_out, (abfd, intern_copy, ext),
- bfd *abfd AND
- DNR *intern_copy AND
- struct dnr_ext *ext)
+ecoff_swap_dnr_out (abfd, intern_copy, ext)
+ bfd *abfd;
+ DNR *intern_copy;
+ struct dnr_ext *ext;
{
DNR intern[1];