This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Please comment: A patch for elf32-i386.c
On Fri, Feb 09, 2001 at 04:24:16PM +1100, Alan Modra wrote:
> On Thu, 8 Feb 2001, H . J . Lu wrote:
>
> > After a second look, I think my patch is ok.
>
> OK, I looked a second (and third) time too, and I believe you're right.
>
Thanks. I checked in the following patch.
--
H.J. Lu (hjl@valinux.com)
--
2001-02-08 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_check_relocs): Reserve R_386_32
relocation entries for weak definitions when building DSO with
-Bsymbolic.
Index: elf32-i386.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i386.c,v
retrieving revision 1.20
diff -u -p -r1.20 elf32-i386.c
--- elf32-i386.c 2001/01/23 20:11:11 1.20
+++ elf32-i386.c 2001/02/09 06:54:04
@@ -643,16 +643,19 @@ elf_i386_check_relocs (abfd, info, sec,
including in the link (i.e., DEF_REGULAR is set). At
this point we have not seen all the input files, so it is
possible that DEF_REGULAR is not set now but will be set
- later (it is never cleared). We account for that
- possibility below by storing information in the
- pcrel_relocs_copied field of the hash table entry.
- A similar situation occurs when creating shared libraries
- and symbol visibility changes render the symbol local. */
+ later (it is never cleared). In case of a weak definition,
+ DEF_REGULAR may be cleared later by a strong definition in
+ a shared library. We account for that possibility below by
+ storing information in the relocs_copied field of the hash
+ table entry. A similar situation occurs when creating
+ shared libraries and symbol visibility changes render the
+ symbol local. */
if (info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& (ELF32_R_TYPE (rel->r_info) != R_386_PC32
|| (h != NULL
&& (! info->symbolic
+ || h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{