* elf32-mips.c, elf64-mips.c, elfn32-mips.c
authorThiemo Seufer <ths@networkno.de>
Tue, 15 Aug 2006 18:28:48 +0000 (18:28 +0000)
committerThiemo Seufer <ths@networkno.de>
Tue, 15 Aug 2006 18:28:48 +0000 (18:28 +0000)
(elf_backend_merge_symbol_attribute): Define.
* elflink.c (elf_link_add_object_symbols): Merge only the ELF
visibility flags.
* elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): New function.

bfd/ChangeLog
bfd/elf32-mips.c
bfd/elf64-mips.c
bfd/elflink.c
bfd/elfn32-mips.c
bfd/elfxx-mips.c

index 2d3538cf2e490a91d2e8d91420e0f6bb9bdc14b0..a5a0df1118acbd1958d3a9c8235a821c6d5ea5ce 100644 (file)
@@ -1,3 +1,12 @@
+2006-08-15  Thiemo Seufer  <ths@mips.com>
+            Nigel Stephens  <nigel@mips.com>
+
+       * elf32-mips.c, elf64-mips.c, elfn32-mips.c
+       (elf_backend_merge_symbol_attribute): Define.
+       * elflink.c (elf_link_add_object_symbols): Merge only the ELF
+       visibility flags.
+       * elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): New function.
+
 2006-08-15  Thiemo Seufer  <ths@mips.com>
             Nigel Stephens  <nigel@mips.com>
             David Ung  <davidu@mips.com>
index e86d95523c9f0e8d4e1d31fcd8ac3329083515da..1a293a051e12b9aa79220835e5245a36333616b8 100644 (file)
@@ -1505,6 +1505,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
 #define elf_backend_create_dynamic_sections \
                                        _bfd_mips_elf_create_dynamic_sections
 #define elf_backend_check_relocs       _bfd_mips_elf_check_relocs
+#define elf_backend_merge_symbol_attribute \
+                                       _bfd_mips_elf_merge_symbol_attribute
 #define elf_backend_adjust_dynamic_symbol \
                                        _bfd_mips_elf_adjust_dynamic_symbol
 #define elf_backend_always_size_sections \
index aa33cf7d6cc29361c29fd7b74c2d4956ce637155..09d13e862fff33f4c7cca46861ab1ea2de66484b 100644 (file)
@@ -3026,6 +3026,8 @@ const struct elf_size_info mips_elf64_size_info =
 #define elf_backend_create_dynamic_sections \
                                _bfd_mips_elf_create_dynamic_sections
 #define elf_backend_check_relocs       _bfd_mips_elf_check_relocs
+#define elf_backend_merge_symbol_attribute \
+                               _bfd_mips_elf_merge_symbol_attribute
 #define elf_backend_adjust_dynamic_symbol \
                                _bfd_mips_elf_adjust_dynamic_symbol
 #define elf_backend_always_size_sections \
index ba0e77e3aa435e10570988d89815ca3069bca339..a7657f9f0025f24ddb7fc1c6fc95ca30427c9eb1 100644 (file)
@@ -4058,13 +4058,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
            isym->st_other = (STV_HIDDEN
                              | (isym->st_other & ~ELF_ST_VISIBILITY (-1)));
 
-         if (isym->st_other != 0 && !dynamic)
+         if (ELF_ST_VISIBILITY (isym->st_other) != 0 && !dynamic)
            {
              unsigned char hvis, symvis, other, nvis;
 
-             /* Take the balance of OTHER from the definition.  */
-             other = (definition ? isym->st_other : h->other);
-             other &= ~ ELF_ST_VISIBILITY (-1);
+             /* Only merge the visibility. Leave the remainder of the
+                st_other field to elf_backend_merge_symbol_attribute.  */
+             other = h->other & ~ELF_ST_VISIBILITY (-1);
 
              /* Combine visibilities, using the most constraining one.  */
              hvis   = ELF_ST_VISIBILITY (h->other);
index 275e83cdc1182fd21df2e30af076efc543332c6e..1e42faaf53781b9ba84a6c5208564576249dfa58 100644 (file)
@@ -2293,6 +2293,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
 #define elf_backend_create_dynamic_sections \
                                        _bfd_mips_elf_create_dynamic_sections
 #define elf_backend_check_relocs       _bfd_mips_elf_check_relocs
+#define elf_backend_merge_symbol_attribute \
+                                       _bfd_mips_elf_merge_symbol_attribute
 #define elf_backend_adjust_dynamic_symbol \
                                        _bfd_mips_elf_adjust_dynamic_symbol
 #define elf_backend_always_size_sections \
index 8ebd2f9450b2bab1e8582dd3f1b9317b73810ac4..cdc81a229d5bf770c1d998a5d4c207e120dd193d 100644 (file)
@@ -11115,15 +11115,25 @@ const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] =
   { NULL,      0,  0, 0,              0 }
 };
 
-/* Ensure that the STO_OPTIONAL flag is copied into h->other,
-   even if this is not a defintion of the symbol.  */
+/* Merge non visibility st_other attributes.  Ensure that the
+   STO_OPTIONAL flag is copied into h->other, even if this is not a
+   definiton of the symbol.  */
 void
 _bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
                                      const Elf_Internal_Sym *isym,
                                      bfd_boolean definition,
                                      bfd_boolean dynamic ATTRIBUTE_UNUSED)
 {
-  if (! definition
+  if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
+    {
+      unsigned char other;
+
+      other = (definition ? isym->st_other : h->other);
+      other &= ~ELF_ST_VISIBILITY (-1);
+      h->other = other | ELF_ST_VISIBILITY (h->other);
+    }
+
+  if (!definition
       && ELF_MIPS_IS_OPTIONAL (isym->st_other))
     h->other |= STO_OPTIONAL;
 }