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 /bfd/elf64-ppc.c | |
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.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r-- | bfd/elf64-ppc.c | 27 |
1 files changed, 18 insertions, 9 deletions
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; |