diff options
author | Phil Blundell <philb@gnu.org> | 2000-10-22 15:19:57 +0000 |
---|---|---|
committer | Phil Blundell <philb@gnu.org> | 2000-10-22 15:19:57 +0000 |
commit | 1cd44cf50f4e5277477e2fe1e740bc7d6f47d108 (patch) | |
tree | f216874ba52479d7befb9e46ac8d6d3b3dfb68ff | |
parent | 058570b9f967c71a58f36acb610a8e5989a253d1 (diff) | |
download | gdb-1cd44cf50f4e5277477e2fe1e740bc7d6f47d108.zip gdb-1cd44cf50f4e5277477e2fe1e740bc7d6f47d108.tar.gz gdb-1cd44cf50f4e5277477e2fe1e740bc7d6f47d108.tar.bz2 |
Merge from mainline
-rw-r--r-- | bfd/ChangeLog | 24 | ||||
-rw-r--r-- | bfd/elf-hppa.h | 3 | ||||
-rw-r--r-- | bfd/elf32-arm.h | 14 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 7 | ||||
-rw-r--r-- | bfd/elf32-m68k.c | 7 | ||||
-rw-r--r-- | bfd/elf32-mcore.c | 3 | ||||
-rw-r--r-- | bfd/elf32-mips.c | 6 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 7 | ||||
-rw-r--r-- | bfd/elf32-sparc.c | 7 | ||||
-rw-r--r-- | bfd/elf64-alpha.c | 7 | ||||
-rw-r--r-- | bfd/elf64-sparc.c | 7 | ||||
-rw-r--r-- | bfd/elflink.c | 17 |
12 files changed, 76 insertions, 33 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e510060..0ce64e9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,27 @@ +2000-10-22 Philip Blundell <philb@gnu.org> + + * elf32-arm.h (elf32_arm_finish_dynamic_symbol): Don't make + PLT entries that could serve as a definition for a weak symbol. + + From 2000-06-05 H.J. Lu <hjl@gnu.org> + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag + an error when seeing an undefined symbol with hidden/internal + attribute. It is handled in *_relocate_section (). + + From 2000-05-23 H.J. Lu <hjl@gnu.org> + * elf32-i386.c (elf_i386_relocate_section): Don't allow the + undefined symbol with the non-default visibility attributes. + * elf-hppa.h (elf_hppa_relocate_section): Likewise. + * elf32-arm.h (elf32_arm_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mcore.c (mcore_elf_relocate_section): Likewise. + * elf32-mips.c (mips_elf_calculate_relocation): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + 2000-10-16 Geoffrey Keating <geoffk@cygnus.com> From 2000-10-14 Geoffrey Keating <geoffk@cygnus.com> diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index b55e1c4..000ffea 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1079,7 +1079,8 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section, relocation = 0; } /* Allow undefined symbols in shared libraries. */ - else if (info->shared && !info->no_undefined) + else if (info->shared && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) { if (info->symbolic) (*info->callbacks->undefined_symbol) diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 7cb5bbc..74fb5bb 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -1807,14 +1807,17 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } @@ -3012,6 +3015,13 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym) /* Mark the symbol as undefined, rather than as defined in the .plt section. Leave the value alone. */ sym->st_shndx = SHN_UNDEF; + /* If the symbol is weak, we do need to clear the value. + Otherwise, the PLT entry would provide a definition for + the symbol even if the symbol wasn't defined anywhere, + and so the symbol would never be NULL. */ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) + == 0) + sym->st_value = 0; } } diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index e4dbf9d..fc1b5a8 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1315,14 +1315,17 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index cc62230..3df26d2 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1479,14 +1479,17 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (!(info->callbacks->undefined_symbol (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 5963a9e..edc6f67 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -532,7 +532,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared) + else if (info->shared + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index d91bab9..6306f10 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -5930,7 +5930,8 @@ mips_elf_calculate_relocation (abfd, and check to see if they exist by looking at their addresses. */ symbol = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) symbol = 0; else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0) { @@ -5948,7 +5949,8 @@ mips_elf_calculate_relocation (abfd, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, input_section, relocation->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return bfd_reloc_undefined; symbol = 0; } diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index e648f02..9eec59b 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3108,7 +3108,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { @@ -3118,7 +3120,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, input_section, rel->r_offset, (!info->shared - || info->no_undefined))) + || info->no_undefined + ELF_ST_VISIBILITY (h->other)))) return false; relocation = 0; } diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index e61a82f..1c8d0ba 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1213,14 +1213,17 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 4da9e92..c8fac53 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3475,14 +3475,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 46e7775..c9e8626 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2049,14 +2049,17 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined)))) + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } diff --git a/bfd/elflink.c b/bfd/elflink.c index c593e49..8039b4f 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -226,21 +226,8 @@ _bfd_elf_link_record_dynamic_symbol (info, h) { case STV_INTERNAL: case STV_HIDDEN: - /* This symbol must be defined in the shared object or - executable. */ - if (h->root.type == bfd_link_hash_undefined) - { - bfd * abfd = h->root.u.undef.abfd; - const char * name = h->root.root.string; - - (*info->callbacks->undefined_symbol) - (info, name, abfd, bfd_und_section_ptr, 0, true); - - /* We have flaged a fatal error. We now treat this as - a normal symbol to avoid further error messages. */ - h->other ^= ELF_ST_VISIBILITY (h->other); - } - else if (h->root.type != bfd_link_hash_undefweak) + if (h->root.type != bfd_link_hash_undefined + && h->root.type != bfd_link_hash_undefweak) { h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; return true; |