* elf32-sparc.c (elf32_sparc_relocate_section): Don't clear
authorJakub Jelinek <jakub@redhat.com>
Fri, 23 Nov 2001 13:16:39 +0000 (13:16 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 23 Nov 2001 13:16:39 +0000 (13:16 +0000)
relocations in non-alloced sections against global symbols
defined in shared library being built.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.

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

index 0b3cd6299d3ccbb31169db6ecb390080c3c9b310..a011579e70d908820d6cc8ee3713f528d1662b18 100644 (file)
@@ -1,3 +1,10 @@
+2001-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf32-sparc.c (elf32_sparc_relocate_section): Don't clear
+       relocations in non-alloced sections against global symbols
+       defined in shared library being built.
+       * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
 2001-11-23  Jakub Jelinek  <jakub@redhat.com>
 
        * elf.c (_bfd_elf_rela_local_sym): New.
index 9458061909257e5950e7d94f003c7e635879115f..60a4dc76fa5023e52871d6a4ce51742f9d693f97 100644 (file)
@@ -1221,7 +1221,15 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
                          || ((r_type == R_SPARC_PC10
                               || r_type == R_SPARC_PC22)
                              && strcmp (h->root.root.string,
-                                        "_GLOBAL_OFFSET_TABLE_") != 0))))
+                                        "_GLOBAL_OFFSET_TABLE_") != 0))
+                     && ((input_section->flags & SEC_ALLOC) != 0
+                         /* DWARF will emit R_SPARC_32 relocations in its
+                            sections against symbols defined externally
+                            in shared libraries.  We can't do anything
+                            with them here.  */
+                         || ((input_section->flags & SEC_DEBUGGING) != 0
+                             && (h->elf_link_hash_flags
+                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))
                {
                  /* In these cases, we don't need the relocation
                      value.  We check specially because in some
index 6af2b15166ce340df1b5ff71272b611d6729c68a..9a918166dea68666001deac3730259e825c8a7ff 100644 (file)
@@ -2053,7 +2053,15 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  if (info->shared
                      && ((!info->symbolic && h->dynindx != -1)
                          || !(h->elf_link_hash_flags
-                              & ELF_LINK_HASH_DEF_REGULAR)))
+                              & ELF_LINK_HASH_DEF_REGULAR))
+                     && ((input_section->flags & SEC_ALLOC) != 0
+                         /* DWARF will emit R_SPARC_{32,64} relocations in
+                            its sections against symbols defined externally
+                            in shared libraries.  We can't do anything
+                            with them here.  */
+                         || ((input_section->flags & SEC_DEBUGGING) != 0
+                             && (h->elf_link_hash_flags
+                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
                    skip_it = true;
                  break;
                }