summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Blundell <pb@futuretv.com>2000-10-22 15:19:57 +0000
committerPhil Blundell <pb@futuretv.com>2000-10-22 15:19:57 +0000
commit4eaecc0505b5bfb7df8c891a9577526932e2b366 (patch)
treed8fa5936f8c411b89b4db203d156c04e67d4cb17
parent665f1b753809b82384f8ced84a9c045fcbf2ae47 (diff)
downloadgdb-4eaecc0505b5bfb7df8c891a9577526932e2b366.tar.gz
Merge from mainline
-rw-r--r--bfd/ChangeLog24
-rw-r--r--bfd/elf-hppa.h3
-rw-r--r--bfd/elf32-arm.h14
-rw-r--r--bfd/elf32-i386.c7
-rw-r--r--bfd/elf32-m68k.c7
-rw-r--r--bfd/elf32-mcore.c3
-rw-r--r--bfd/elf32-mips.c6
-rw-r--r--bfd/elf32-ppc.c7
-rw-r--r--bfd/elf32-sparc.c7
-rw-r--r--bfd/elf64-alpha.c7
-rw-r--r--bfd/elf64-sparc.c7
-rw-r--r--bfd/elflink.c17
12 files changed, 76 insertions, 33 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e510060f991..0ce64e9fdc5 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 b55e1c4e5bc..000ffea3c75 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 7cb5bbc2332..74fb5bbaa4d 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 e4dbf9da096..fc1b5a8ccb6 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 cc622301755..3df26d2c7f9 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 5963a9eff6e..edc6f678c22 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 d91bab97268..6306f108365 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 e648f0256c2..9eec59bde5c 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 e61a82fabeb..1c8d0ba275a 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 4da9e925c63..c8fac5361ec 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 46e777552f2..c9e862677ac 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 c593e496f95..8039b4fe35b 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;