This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

[patch] current: MIPS64/ELF handle relocations in .pdr sections


Hello,

 I have a problem with a final link failing for MIPS64/ELF due to
relocations against discarded symbols located in .pdr sections.  The
following patch implements handling of relocations for these sections like
it's now done for MIPS/ELF.  It fixes the problem for me.

 If it's going to be included as is, it should be unified for both
platforms and go to elfxx-mips.c.  But first I'd like to be sure it's the
right fix.  I couldn't find any specification of the .pdr section for
MIPS, so I'm not sure if such a usage is appropriate for MIPS64/ELF.  Does
anyone have a reference? 

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

binutils-2.12.90-20020520-mips64-pdr.patch
diff -up --recursive --new-file binutils.macro/bfd/elf64-mips.c binutils/bfd/elf64-mips.c
--- binutils.macro/bfd/elf64-mips.c	2002-04-05 03:25:28.000000000 +0000
+++ binutils/bfd/elf64-mips.c	2002-05-26 11:40:29.000000000 +0000
@@ -122,6 +122,8 @@ static boolean mips_elf64_assign_gp PARA
 static bfd_reloc_status_type mips_elf64_final_gp
   PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *));
 static boolean mips_elf64_object_p PARAMS ((bfd *));
+static boolean elf64_mips_ignore_discarded_relocs
+  PARAMS ((asection *));
 static irix_compat_t elf64_mips_irix_compat PARAMS ((bfd *));
 
 extern const bfd_target bfd_elf64_tradbigmips_vec;
@@ -2586,7 +2588,16 @@ mips_elf64_object_p (abfd)
   bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
   return true;
 }
-
+
+static boolean
+elf64_mips_ignore_discarded_relocs (sec)
+     asection *sec;
+{
+  if (strcmp (sec->name, ".pdr") == 0)
+    return true;
+  return false;
+}
+
 /* Depending on the target vector we generate some version of Irix
    executables or "normal" MIPS ELF ABI executables.  */
 static irix_compat_t
@@ -2719,6 +2730,8 @@ const struct elf_size_info mips_elf64_si
 #define elf_backend_gc_mark_hook	_bfd_mips_elf_gc_mark_hook
 #define elf_backend_gc_sweep_hook	_bfd_mips_elf_gc_sweep_hook
 #define elf_backend_hide_symbol		_bfd_mips_elf_hide_symbol
+#define elf_backend_ignore_discarded_relocs \
+				elf64_mips_ignore_discarded_relocs
 #define elf_backend_mips_irix_compat	elf64_mips_irix_compat
 #define elf_backend_mips_rtype_to_howto	mips_elf64_rtype_to_howto
 #define elf_backend_ecoff_debug_swap	&mips_elf64_ecoff_debug_swap


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