diff options
author | Alan Modra <amodra@gmail.com> | 2003-05-01 10:22:46 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-05-01 10:22:46 +0000 |
commit | 81848ca0c80045dd202aec165bd56ede271f9325 (patch) | |
tree | 56753cd6c8a4eba77ca941dc8660ae3e22af1b5e | |
parent | 130cacceca840fe1b78c6a1f67c37f6bab3f7fc6 (diff) | |
download | gdb-81848ca0c80045dd202aec165bd56ede271f9325.zip gdb-81848ca0c80045dd202aec165bd56ede271f9325.tar.gz gdb-81848ca0c80045dd202aec165bd56ede271f9325.tar.bz2 |
* elf32-ppc.c (ppc_elf_copy_indirect_symbol): Test whether the
weakdef sym has already been adjusted before treating it specially.
* elf32-i386.c (elf_i386_copy_indirect_symbol): Don't copy
ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted.
* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
(ppc64_elf_check_relocs): Set ELF_LINK_NON_GOT_REF.
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 14 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 4 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 27 |
4 files changed, 41 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 34883f6..93b7fda 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,7 +1,11 @@ -2003-04-30 Nick Clifton <nickc@redhat.com> +2003-05-01 Alan Modra <amodra@bigpond.net.au> - * elf32-h8300.c (elf32_h8_relax_section): Do not crash when - encountering relocs against the *ABS* section. + * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Test whether the + weakdef sym has already been adjusted before treating it specially. + * elf32-i386.c (elf_i386_copy_indirect_symbol): Don't copy + ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted. + * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. + (ppc64_elf_check_relocs): Set ELF_LINK_NON_GOT_REF. 2003-04-28 H.J. Lu <hjl@gnu.org> diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 4f6bd80..060d66c 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -838,7 +838,19 @@ elf_i386_copy_indirect_symbol (bed, dir, ind) edir->tls_type = eind->tls_type; eind->tls_type = GOT_UNKNOWN; } - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + + if (ELIMINATE_COPY_RELOCS + && ind->root.type != bfd_link_hash_indirect + && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->elf_link_hash_flags |= + (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + else + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } static int diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 22cff53..69bb0d6 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -374,7 +374,9 @@ ppc_elf_copy_indirect_symbol (bed, dir, ind) edir->tls_mask |= eind->tls_mask; - if (ELIMINATE_COPY_RELOCS && ind->root.type != bfd_link_hash_indirect) + if (ELIMINATE_COPY_RELOCS + && ind->root.type != bfd_link_hash_indirect + && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) /* If called to transfer flags for a weakdef during processing of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. We clear it ourselves for ELIMINATE_COPY_RELOCS. */ diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 29c90fe..1e7a498 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -3272,6 +3272,7 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind) struct elf_link_hash_entry *dir, *ind; { struct ppc_link_hash_entry *edir, *eind; + flagword mask; edir = (struct ppc_link_hash_entry *) dir; eind = (struct ppc_link_hash_entry *) ind; @@ -3316,20 +3317,24 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind) edir->is_entry |= eind->is_entry; edir->tls_mask |= eind->tls_mask; - /* Copy down any references that we may have already seen to the - symbol which just became indirect. */ - edir->elf.elf_link_hash_flags |= - (eind->elf.elf_link_hash_flags - & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF)); + mask = (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF); + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + if (ELIMINATE_COPY_RELOCS + && eind->elf.root.type != bfd_link_hash_indirect + && (edir->elf.elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) + mask &= ~ELF_LINK_NON_GOT_REF; + + edir->elf.elf_link_hash_flags |= eind->elf.elf_link_hash_flags & mask; /* If we were called to copy over info for a weak sym, that's all. */ if (eind->elf.root.type != bfd_link_hash_indirect) return; - /* Copy over got entries. */ + /* Copy over got entries that we may have already seen to the + symbol which just became indirect. */ if (eind->elf.got.glist != NULL) { if (edir->elf.got.glist != NULL) @@ -3877,6 +3882,10 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs) case R_PPC64_UADDR32: case R_PPC64_UADDR64: case R_PPC64_TOC: + if (h != NULL && !info->shared) + /* We may need a copy reloc. */ + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + /* Don't propagate .opd relocs. */ if (NO_OPD_RELOCS && opd_sym_map != NULL) break; |