aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-mips.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-07-07 17:50:56 +0000
committerMark Mitchell <mark@codesourcery.com>1999-07-07 17:50:56 +0000
commitc7ac6ff835615a523fe86575cd5fae3f93f88430 (patch)
treeb3b6c2a0430fa8c023ab019d2e7e0efa8cb141f9 /bfd/elf64-mips.c
parent9846de1bb5d61521885ef51fa6b99121ec1be577 (diff)
downloadgdb-c7ac6ff835615a523fe86575cd5fae3f93f88430.zip
gdb-c7ac6ff835615a523fe86575cd5fae3f93f88430.tar.gz
gdb-c7ac6ff835615a523fe86575cd5fae3f93f88430.tar.bz2
* elflink.h (elf_link_create_dynamic_sections): Handle non-standard
hash-entry sizes. (size_dynamic_sections): Likewise. (elf_link_output_extsym): Likewise. * elf.c: (elf_fake_sections): Likewise. * libbfd.c (bfd_get): New macro. (bfd_put): Likewise. * bfd-in2.h: Regenerated. * elf-bfd.h (elf_size_info): Add hash_entry_size, int_rels_per_ext_rel, swap_dyn_out, swap_reloc_in, swap_reloc_out, wap_reloca_in, and swap_reloca_out. * elflink.h (elf_link_read_relocs_from_section): Adjust to handle multiple internal relocations per external relocation. (link_read_relocs): Likewise. (elf_bfd_final_link): Likewise. (elf_link_input_bfd): Likewise. (elf_gc_mark): Likewise. (elf_gc_smash_unused_vtentry_relocs): Likewise. * elfcode.h (elf_swap_dyn_out): Adjust type to match elf_swap_dyn_in. (size_info): Add entries for new fields. * elf64-mips.c (mips_elf64_swap_reloc_out): Enable. (mips_elf64_be_swap_reloc_in): New function. (mips_elf64_be_swap_reloc_out): Likewise. (mips_elf64_be_swap_reloca_in): Likewise. (mips_elf64_be_swap_reloca_out): Likewise. (mips_elf64_size_info): Add entries for new fields.
Diffstat (limited to 'bfd/elf64-mips.c')
-rw-r--r--bfd/elf64-mips.c115
1 files changed, 106 insertions, 9 deletions
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 36e6075..79b172f 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -52,14 +52,20 @@ static void mips_elf64_swap_reloc_in
static void mips_elf64_swap_reloca_in
PARAMS ((bfd *, const Elf64_Mips_External_Rela *,
Elf64_Mips_Internal_Rela *));
-#if 0
static void mips_elf64_swap_reloc_out
PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *,
Elf64_Mips_External_Rel *));
-#endif
static void mips_elf64_swap_reloca_out
PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *,
Elf64_Mips_External_Rela *));
+static void mips_elf64_be_swap_reloc_in
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
+static void mips_elf64_be_swap_reloc_out
+ PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
+static void mips_elf64_be_swap_reloca_in
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+static void mips_elf64_be_swap_reloca_out
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
static reloc_howto_type *mips_elf64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *));
@@ -1220,10 +1226,6 @@ mips_elf64_swap_reloca_in (abfd, src, dst)
dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend);
}
-#if 0
-
-/* This is not currently used. */
-
/* Swap out a MIPS 64-bit Rel reloc. */
static void
@@ -1240,8 +1242,6 @@ mips_elf64_swap_reloc_out (abfd, src, dst)
bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
}
-#endif /* 0 */
-
/* Swap out a MIPS 64-bit Rela reloc. */
static void
@@ -1259,6 +1259,96 @@ mips_elf64_swap_reloca_out (abfd, src, dst)
bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend);
}
+/* Swap in a MIPS 64-bit Rel reloc. */
+
+static void
+mips_elf64_be_swap_reloc_in (abfd, src, dst)
+ bfd *abfd;
+ const bfd_byte *src;
+ Elf_Internal_Rel *dst;
+{
+ Elf64_Mips_Internal_Rel mirel;
+
+ mips_elf64_swap_reloc_in (abfd,
+ (const Elf64_Mips_External_Rel *) src,
+ &mirel);
+
+ dst[0].r_offset = mirel.r_offset;
+ dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type);
+ dst[1].r_offset = mirel.r_offset;
+ dst[1].r_info = ELF32_R_INFO (mirel.r_ssym, mirel.r_type2);
+ dst[2].r_offset = mirel.r_offset;
+ dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirel.r_type3);
+}
+
+/* Swap in a MIPS 64-bit Rela reloc. */
+
+static void
+mips_elf64_be_swap_reloca_in (abfd, src, dst)
+ bfd *abfd;
+ const bfd_byte *src;
+ Elf_Internal_Rela *dst;
+{
+ Elf64_Mips_Internal_Rela mirela;
+
+ mips_elf64_swap_reloca_in (abfd,
+ (const Elf64_Mips_External_Rela *) src,
+ &mirela);
+
+ dst[0].r_offset = mirela.r_offset;
+ dst[0].r_info = ELF32_R_INFO (mirela.r_sym, mirela.r_type);
+ dst[0].r_addend = mirela.r_addend;
+ dst[1].r_offset = mirela.r_offset;
+ dst[1].r_info = ELF32_R_INFO (mirela.r_ssym, mirela.r_type2);
+ dst[1].r_addend = 0;
+ dst[2].r_offset = mirela.r_offset;
+ dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirela.r_type3);
+ dst[2].r_addend = 0;
+}
+
+/* Swap out a MIPS 64-bit Rel reloc. */
+
+static void
+mips_elf64_be_swap_reloc_out (abfd, src, dst)
+ bfd *abfd;
+ const Elf_Internal_Rel *src;
+ bfd_byte *dst;
+{
+ Elf64_Mips_Internal_Rel mirel;
+
+ mirel.r_offset = src->r_offset;
+ mirel.r_type = ELF32_R_TYPE (src->r_info);
+ mirel.r_sym = ELF32_R_SYM (src->r_info);
+ mirel.r_type2 = R_MIPS_NONE;
+ mirel.r_ssym = STN_UNDEF;
+ mirel.r_type3 = R_MIPS_NONE;
+
+ mips_elf64_swap_reloc_out (abfd, &mirel,
+ (Elf64_Mips_External_Rel *) dst);
+}
+
+/* Swap out a MIPS 64-bit Rela reloc. */
+
+static void
+mips_elf64_be_swap_reloca_out (abfd, src, dst)
+ bfd *abfd;
+ const Elf_Internal_Rela *src;
+ bfd_byte *dst;
+{
+ Elf64_Mips_Internal_Rela mirela;
+
+ mirela.r_offset = src->r_offset;
+ mirela.r_type = ELF32_R_TYPE (src->r_info);
+ mirela.r_addend = src->r_addend;
+ mirela.r_sym = ELF32_R_SYM (src->r_info);
+ mirela.r_type2 = R_MIPS_NONE;
+ mirela.r_ssym = STN_UNDEF;
+ mirela.r_type3 = R_MIPS_NONE;
+
+ mips_elf64_swap_reloca_out (abfd, &mirela,
+ (Elf64_Mips_External_Rela *) dst);
+}
+
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
struct elf_reloc_map
@@ -2099,6 +2189,8 @@ const struct elf_size_info mips_elf64_size_info =
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
+ 4, /* hash-table entry size */
+ 3, /* internal relocations per external relocations */
64, /* arch_size */
8, /* file_align */
ELFCLASS64,
@@ -2109,7 +2201,12 @@ const struct elf_size_info mips_elf64_size_info =
bfd_elf64_swap_symbol_out,
mips_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
- bfd_elf64_swap_dyn_in
+ bfd_elf64_swap_dyn_in,
+ bfd_elf64_swap_dyn_out,
+ mips_elf64_be_swap_reloc_in,
+ mips_elf64_be_swap_reloc_out,
+ mips_elf64_be_swap_reloca_in,
+ mips_elf64_be_swap_reloca_out
};
#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec