summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2000-05-30 20:51:36 +0000
committerH.J. Lu <hjl@lucon.org>2000-05-30 20:51:36 +0000
commitbdad84228ef2a1f84b612c4d7e055dd1381364bb (patch)
tree2e181698a4ddd2bead895bf21a4cf1e5ba9a9d8c
parente12e6424dddeb3ced2abc68d96b8e918888b8898 (diff)
downloadgdb-bdad84228ef2a1f84b612c4d7e055dd1381364bb.tar.gz
2000-05-30 H.J. Lu <hjl@gnu.org>
* elflink.c (_bfd_elf_link_record_dynamic_symbol): Clear the visibility bits if the symbol is undefined. Correctly handle weak undefined symbols with hidden and internal attributes. * elflink.h (elf_link_add_object_symbols): Always turn the symbol into local if it has the hidden or internal attribute.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elflink.c12
-rw-r--r--bfd/elflink.h8
3 files changed, 20 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0884d78e521..08eea2afe8d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2000-05-30 H.J. Lu <hjl@gnu.org>
+
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Clear the
+ visibility bits if the symbol is undefined. Correctly handle
+ weak undefined symbols with hidden and internal attributes.
+
+ * elflink.h (elf_link_add_object_symbols): Always turn the
+ symbol into local if it has the hidden or internal attribute.
+
2000-05-29 Philip Blundell <philb@gnu.org>
* ppcboot.c: Add packed attribute if compiling with GCC.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 1b1548a707c..c593e496f95 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -235,10 +235,16 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
(*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)
+ {
+ h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
+ return true;
}
-
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- return true;
default:
break;
diff --git a/bfd/elflink.h b/bfd/elflink.h
index f1dab7059f2..d09ad172a2b 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -890,7 +890,6 @@ elf_link_add_object_symbols (abfd, info)
Elf_External_Sym *esym;
Elf_External_Sym *esymend;
struct elf_backend_data *bed;
- boolean visibility_changed = false;
bed = get_elf_backend_data (abfd);
add_symbol_hook = bed->elf_add_symbol_hook;
@@ -1581,10 +1580,7 @@ elf_link_add_object_symbols (abfd, info)
unsigned char symvis = ELF_ST_VISIBILITY (sym.st_other);
if (symvis && (hvis > symvis || hvis == 0))
- {
- visibility_changed = true;
- h->other = sym.st_other;
- }
+ h->other = sym.st_other;
/* If neither has visibility, use the st_other of the
definition. This is an arbitrary choice, since the
@@ -1855,7 +1851,7 @@ elf_link_add_object_symbols (abfd, info)
goto error_return;
}
}
- else if (dynsym && h->dynindx != -1 && visibility_changed)
+ else if (dynsym && h->dynindx != -1)
/* If the symbol already has a dynamic index, but
visibility says it should not be visible, turn it into
a local symbol. */