* elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Apr 2002 17:42:39 +0000 (17:42 +0000)
committerJakub Jelinek <jakub@redhat.com>
Wed, 3 Apr 2002 17:42:39 +0000 (17:42 +0000)
PC relative relocs against hidden symbols.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.

bfd/ChangeLog
bfd/elf32-sparc.c
bfd/elf64-sparc.c

index 4093a38a5d82d0e012a3b3610ef1f560d6102774..01295e132d30cf6fa17d5e350ff0493de787aecf 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
+       PC relative relocs against hidden symbols.
+       * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
 2002-04-03  Alan Modra  <amodra@bigpond.net.au>
 
        * elf.c (_bfd_elf_make_section_from_shdr): When setting section
index fff9fa2edc2b45f47b06b1766b09429d94a1e397..a11db81c305300fcd8ca1304d2995345263c10c0 100644 (file)
@@ -1467,6 +1467,17 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
                  if (!(outrel.r_offset & 3))
                    r_type = R_SPARC_32;
                  break;
+               case R_SPARC_DISP8:
+               case R_SPARC_DISP16:
+               case R_SPARC_DISP32:
+                 /* If the symbol is not dynamic, we should not keep
+                    a dynamic relocation.  But an .rela.* slot has been
+                    allocated for it, output R_SPARC_NONE.
+                    FIXME: Add code tracking needed dynamic relocs as
+                    e.g. i386 has.  */
+                 if (h->dynindx == -1)
+                   skip = true, relocate = true;
+                 break;
                }
 
              if (skip)
index 3305f99c7e37bbed59d217901b70390088696b5d..78d2a560f67b4472ce8ce73c666cc6276134ce42 100644 (file)
@@ -2053,11 +2053,11 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            case R_SPARC_DISP8:
            case R_SPARC_DISP16:
            case R_SPARC_DISP32:
+           case R_SPARC_DISP64:
            case R_SPARC_WDISP30:
            case R_SPARC_WDISP22:
            case R_SPARC_WDISP19:
            case R_SPARC_WDISP16:
-           case R_SPARC_DISP64:
              if (h == NULL)
                break;
              /* Fall through.  */
@@ -2146,6 +2146,18 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  case R_SPARC_UA64:
                    if (!(outrel.r_offset & 7)) r_type = R_SPARC_64;
                    break;
+                 case R_SPARC_DISP8:
+                 case R_SPARC_DISP16:
+                 case R_SPARC_DISP32:
+                 case R_SPARC_DISP64:
+                   /* If the symbol is not dynamic, we should not keep
+                      a dynamic relocation.  But an .rela.* slot has been
+                      allocated for it, output R_SPARC_NONE.
+                      FIXME: Add code tracking needed dynamic relocs as
+                      e.g. i386 has.  */
+                   if (h->dynindx == -1)
+                     skip = true, relocate = true;
+                   break;
                  }
 
                if (skip)