This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Fix the mips linker
- To: binutils at sourceware dot cygnus dot com
- Subject: PATCH: Fix the mips linker
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Thu, 11 Oct 2001 11:13:41 -0700
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