* elf64-x86-64.c (allocate_dynrelocs): Don't allocate dynamic
authorAndreas Jaeger <aj@suse.de>
Mon, 5 May 2003 08:50:43 +0000 (08:50 +0000)
committerAndreas Jaeger <aj@suse.de>
Mon, 5 May 2003 08:50:43 +0000 (08:50 +0000)
relocation entries for weak undefined symbols with non-default
visibility.
(elf64_x86_64_relocate_section): Initialize the GOT entries and
skip R_386_32/R_386_PC32 for weak undefined symbols with
non-default visibility.

bfd/ChangeLog
bfd/elf64-x86-64.c

index e209e3d..42c07e8 100644 (file)
@@ -1,3 +1,12 @@
+2003-05-05  Andreas Jaeger  <aj@suse.de>
+
+       * elf64-x86-64.c (allocate_dynrelocs): Don't allocate dynamic
+       relocation entries for weak undefined symbols with non-default
+       visibility.
+       (elf64_x86_64_relocate_section): Initialize the GOT entries and
+       skip R_386_32/R_386_PC32 for weak undefined symbols with
+       non-default visibility.
+
 2003-05-04  H.J. Lu <hjl@gnu.org>
 
        * elf32-i386.c (allocate_dynrelocs): Don't allocate dynamic
index 5ed6b51..f8d2a0c 100644 (file)
@@ -1396,7 +1396,9 @@ allocate_dynrelocs (h, inf)
            return FALSE;
        }
 
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+      if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+          || h->root.type != bfd_link_hash_undefweak)
+         && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
        {
          asection *s = htab->splt;
 
@@ -1478,7 +1480,9 @@ allocate_dynrelocs (h, inf)
        htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
       else if (tls_type == GOT_TLS_GD)
        htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
-      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+      else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+               || h->root.type != bfd_link_hash_undefweak)
+              && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
        htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
     }
   else
@@ -1976,7 +1980,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
                      && (info->symbolic
                          || h->dynindx == -1
                          || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-                     && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+                     && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+                 || (ELF_ST_VISIBILITY (h->other)
+                     && h->root.type == bfd_link_hash_undefweak))
                {
                  /* This is actually a static link, or it is a -Bsymbolic
                     link and the symbol is defined locally, or the symbol
@@ -2095,6 +2101,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
            break;
 
          if ((info->shared
+              && (h == NULL
+                  || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+                  || h->root.type != bfd_link_hash_undefweak)
               && ((r_type != R_X86_64_PC8
                    && r_type != R_X86_64_PC16
                    && r_type != R_X86_64_PC32)