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]

PATCH: Fix the mips linker


We shouldn't create dynamic relocation for for symbols defined in
regular objects when creating executables. We can have both the
ELF_LINK_HASH_DEF_DYNAMIC and ELF_LINK_HASH_DEF_REGULAR bits set, if
we see the weak dynamic definition first, which is overridden by a
weak regular definition later. It is necessary since the dynamic linker
will favor the weak regular definition over the weak dynamic definition
at the runtime. In this case, _bfd_mips_elf_adjust_dynamic_symbol won't
be called to allocate the relocation for it at all.


H.J.
----
2001-10-11  H.J. Lu  <hjl@gnu.org>

	* elf32-mips.c (mips_elf_calculate_relocation): Don't create
	dynamic relocation for for symbols defined in regular objects
	when creating executables.

Index: elf32-mips.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-mips.c,v
retrieving revision 1.46
diff -u -p -r1.46 elf32-mips.c
--- elf32-mips.c	2001/10/05 20:31:11	1.46
+++ elf32-mips.c	2001/10/11 17:59:32
@@ -6319,8 +6319,10 @@ mips_elf_calculate_relocation (abfd,
       if ((info->shared
 	   || (elf_hash_table (info)->dynamic_sections_created
 	       && h != NULL
-	       && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
-		   != 0)))
+	       && ((h->root.elf_link_hash_flags
+		    & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+	       && ((h->root.elf_link_hash_flags
+		    & ELF_LINK_HASH_DEF_REGULAR) == 0)))
 	  && (input_section->flags & SEC_ALLOC) != 0)
 	{
 	  /* If we're creating a shared library, or this relocation is


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