This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH for i386: --no-copy-relocs
On Sat, Jun 23, 2001 at 05:07:45PM -0700, H . J . Lu wrote:
> >
> > Alan,
> >
> > This patch seems to work for me. The condition we want to check is
> > a symbol is defined, but not defined in the regular object. I think we
> > should check ELF_LINK_HASH_DEF_DYNAMIC, not ELF_LINK_HASH_DEF_REGULAR
> > since the common symbol in the regular object won't set
> > ELF_LINK_HASH_DEF_REGULAR.
> >
> > I will also check if it handls the weak symbol right.
> >
> >
>
> No. The weak symbol is broken. This patch works. Alan, what do you
> think? Could you please double check the rest of your changes?
>
> Thanks.
>
>
I checked in the following patch.
H.J.
----
2001-06-23 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_relocate_section): Check the
ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined
in the regular object file and treat the weak definition as
the normal one.
Index: elf32-i386.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i386.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf32-i386.c
--- elf32-i386.c 2001/06/24 00:25:19 1.29
+++ elf32-i386.c 2001/06/24 00:33:44
@@ -1693,9 +1693,10 @@ elf_i386_relocate_section (output_bfd, i
&& h != NULL
&& h->dynindx != -1
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ && ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
{
Elf_Internal_Rel outrel;
boolean skip, relocate;