aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-11-21 18:52:36 +0000
committerRichard Henderson <rth@redhat.com>2002-11-21 18:52:36 +0000
commit7c25b72c17fb4647ec34275270088a8f78d41a3b (patch)
treeddd6193ae4171c485d0fe311ed112043e5d94e6a /bfd
parent782c0ebfc98dfc58a816440d29094a586a78ed7d (diff)
downloadgdb-7c25b72c17fb4647ec34275270088a8f78d41a3b.zip
gdb-7c25b72c17fb4647ec34275270088a8f78d41a3b.tar.gz
gdb-7c25b72c17fb4647ec34275270088a8f78d41a3b.tar.bz2
* elflink.h (elf_link_add_object_symbols): Don't overwrite the
arch's st_other bits when merging visibilities. (elf_link_output_extsym): Tidy clearing of visibility field.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.h27
2 files changed, 18 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c86e62f..d3c7ac8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2002-11-21 Richard Henderson <rth@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Don't overwrite the
+ arch's st_other bits when merging visibilities.
+ (elf_link_output_extsym): Tidy clearing of visibility field.
+
2002-11-21 Alan Modra <amodra@bigpond.net.au>
* coff-mcore.c (SWAP_IN_RELOC_OFFSET): Define.
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 721b361..f784002 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -1938,19 +1938,17 @@ elf_link_add_object_symbols (abfd, info)
might be needed here. */
if (isym->st_other != 0)
{
+ unsigned char hvis, symvis, other;
+
+ /* Take the balance of OTHER from the definition. */
+ other = (definition ? isym->st_other : h->other);
+ other &= ~ ELF_ST_VISIBILITY (-1);
+
/* Combine visibilities, using the most constraining one. */
- unsigned char hvis = ELF_ST_VISIBILITY (h->other);
- unsigned char symvis = ELF_ST_VISIBILITY (isym->st_other);
-
- if (symvis && (hvis > symvis || hvis == 0))
- h->other = isym->st_other;
-
- /* If neither has visibility, use the st_other of the
- definition. This is an arbitrary choice, since the
- other bits have no general meaning. */
- if (!symvis && !hvis
- && (definition || h->other == 0))
- h->other = isym->st_other;
+ hvis = ELF_ST_VISIBILITY (h->other);
+ symvis = ELF_ST_VISIBILITY (isym->st_other);
+
+ h->other = other | (hvis > symvis ? hvis : symvis);
}
/* Set a flag in the hash table entry indicating the type of
@@ -6389,11 +6387,10 @@ elf_link_output_extsym (h, data)
sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
}
- /* If a symbol is not defined locally, we clear the visibility
- field. */
+ /* If a symbol is not defined locally, we clear the visibility field. */
if (! finfo->info->relocateable
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other);
+ sym.st_other &= ~ ELF_ST_VISIBILITY (-1);
/* If this symbol should be put in the .dynsym section, then put it
there now. We already know the symbol index. We also fill in