This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

mips64 relocation fix


Hi,

Here's a patch to fix some relocation stuff for elf64-mips.c.

Ulf

2000-05-03  Ulf Carlsson  <ulfc@engr.sgi.com>

	* elf64-mips.c (mips_elf64_be_swap_reloc_in): Use ELF64_R_INFO instead
	of ELF32_R_INFO.
	(mips_elf64_be_swap_reloca_in): Likewise.
	(mips_elf64_be_swap_reloc_out): Use ELF64_R_{TYPE|SYM} instead of
	ELF32_R_{TYPE|SYM}
	(mips_elf64_be_swap_reloca_out): Likewise.
	(mips_elf64_size_info): We still swap out the relocations one by one
	and not three at once.


Index: elf64-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mips.c,v
retrieving revision 1.9
diff -u -p -r1.9 elf64-mips.c
--- elf64-mips.c	1999/12/10 18:51:34	1.9
+++ elf64-mips.c	2000/05/03 12:44:15
@@ -1275,11 +1275,11 @@ mips_elf64_be_swap_reloc_in (abfd, src, 
 			    &mirel);
 
   dst[0].r_offset = mirel.r_offset;
-  dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type);
+  dst[0].r_info = ELF64_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[1].r_info = ELF64_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);
+  dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
 }
 
 /* Swap in a MIPS 64-bit Rela reloc.  */
@@ -1297,13 +1297,13 @@ mips_elf64_be_swap_reloca_in (abfd, 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_info = ELF64_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_info = ELF64_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_info = ELF64_R_INFO (STN_UNDEF, mirela.r_type3);
   dst[2].r_addend = 0;
 }
 
@@ -1318,8 +1318,8 @@ mips_elf64_be_swap_reloc_out (abfd, src,
   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_type = ELF64_R_TYPE (src->r_info);
+  mirel.r_sym = ELF64_R_SYM (src->r_info);
   mirel.r_type2 = R_MIPS_NONE;
   mirel.r_ssym = STN_UNDEF;
   mirel.r_type3 = R_MIPS_NONE;
@@ -1339,9 +1339,9 @@ mips_elf64_be_swap_reloca_out (abfd, src
   Elf64_Mips_Internal_Rela mirela;
 
   mirela.r_offset = src->r_offset;
-  mirela.r_type = ELF32_R_TYPE (src->r_info);
+  mirela.r_type = ELF64_R_TYPE (src->r_info);
   mirela.r_addend = src->r_addend;
-  mirela.r_sym = ELF32_R_SYM (src->r_info);
+  mirela.r_sym = ELF64_R_SYM (src->r_info);
   mirela.r_type2 = R_MIPS_NONE;
   mirela.r_ssym = STN_UNDEF;
   mirela.r_type3 = R_MIPS_NONE;
@@ -2082,7 +2082,7 @@ const struct elf_size_info mips_elf64_si
   sizeof (Elf64_External_Dyn),
   sizeof (Elf_External_Note),
   4,            /* hash-table entry size */
-  3,            /* internal relocations per external relocations */
+  1,            /* internal relocations per external relocations */
   64,		/* arch_size */
   8,		/* file_align */
   ELFCLASS64,
@@ -2186,5 +2186,9 @@ const struct elf_size_info mips_elf64_si
 					_bfd_archive_coff_generic_stat_arch_elt
 #define bfd_elf64_archive_update_armap_timestamp \
 				_bfd_archive_coff_update_armap_timestamp
+#define bfd_elf64_swap_reloc_in		mips_elf64_be_swap_reloc_in
+#define bfd_elf64_swap_reloca_in	mips_elf64_be_swap_reloca_in
+#define bfd_elf64_swap_reloc_out	mips_elf64_be_swap_reloc_out
+#define bfd_elf64_swap_reloca_out	mips_elf64_be_swap_reloca_out
 
 #include "elf64-target.h"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]