* elf32-s390.c (elf_s390_relocate_section): Only convert R_390_32
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 13 Nov 2003 15:56:50 +0000 (15:56 +0000)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 13 Nov 2003 15:56:50 +0000 (15:56 +0000)
to R_390_RELAVITE. Convert the other relocations against local
symbols to relocations against the start of the section.
* elf64-s390.c (elf_s390_relocate_section): Only convert R_390_64
to R_390_RELAVITE. Convert the other relocations against local
symbols to relocations against the start of the section.

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

index 2fd5efe20d813a09e1db5fe1d2b29309f3e81d7a..4c5754ed7aed039d5e9148eee02f45b9b99ca7f2 100644 (file)
@@ -1,3 +1,12 @@
+2003-11-13  Martin Schwidefsky  <schwidefsky@de.ibm.com>
+
+       * elf32-s390.c (elf_s390_relocate_section): Only convert R_390_32
+       to R_390_RELAVITE. Convert the other relocations against local
+       symbols to relocations against the start of the section.
+       * elf64-s390.c (elf_s390_relocate_section): Only convert R_390_64
+       to R_390_RELAVITE. Convert the other relocations against local
+       symbols to relocations against the start of the section.
+
 2003-11-11  Nick Clifton  <nickc@redhat.com>
 
        * elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use
index 80a753ac9dc7b651dc6c1c3e46d357adfae9a33d..61b1cbfc29677ac4f0d14ccd0c8381482cce8fda 100644 (file)
@@ -2626,9 +2626,43 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              else
                {
                  /* This symbol is local, or marked to become local.  */
-                 relocate = TRUE;
-                 outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
-                 outrel.r_addend = relocation + rel->r_addend;
+                 if (r_type == R_390_32)
+                   {
+                     relocate = TRUE;
+                     outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
+                     outrel.r_addend = relocation + rel->r_addend;
+                   }
+                 else
+                   {
+                     long sindx;
+
+                     if (h == NULL)
+                       sec = local_sections[r_symndx];
+                     else
+                       {
+                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
+                                     || (h->root.type
+                                         == bfd_link_hash_defweak));
+                         sec = h->root.u.def.section;
+                       }
+                     if (sec != NULL && bfd_is_abs_section (sec))
+                       sindx = 0;
+                     else if (sec == NULL || sec->owner == NULL)
+                       {
+                         bfd_set_error(bfd_error_bad_value);
+                         return FALSE;
+                       }
+                     else
+                       {
+                         asection *osec;
+
+                         osec = sec->output_section;
+                         sindx = elf_section_data (osec)->dynindx;
+                         BFD_ASSERT (sindx > 0);
+                       }
+                     outrel.r_info = ELF32_R_INFO (sindx, r_type);
+                     outrel.r_addend = relocation + rel->r_addend;
+                   }
                }
 
              sreloc = elf_section_data (input_section)->sreloc;
index 6e72ced5c63f738a542d39256929813aac2c2042..b4da0b124e00016debaca9a8824c214eaa618b1f 100644 (file)
@@ -2605,9 +2605,43 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              else
                {
                  /* This symbol is local, or marked to become local.  */
-                 relocate = TRUE;
-                 outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
-                 outrel.r_addend = relocation + rel->r_addend;
+                 if (r_type == R_390_64)
+                   {
+                     relocate = TRUE;
+                     outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+                     outrel.r_addend = relocation + rel->r_addend;
+                   }
+                 else
+                   {
+                     long sindx;
+
+                     if (h == NULL)
+                       sec = local_sections[r_symndx];
+                     else
+                       {
+                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
+                                     || (h->root.type
+                                         == bfd_link_hash_defweak));
+                         sec = h->root.u.def.section;
+                       }
+                     if (sec != NULL && bfd_is_abs_section (sec))
+                       sindx = 0;
+                     else if (sec == NULL || sec->owner == NULL)
+                       {
+                         bfd_set_error(bfd_error_bad_value);
+                         return FALSE;
+                       }
+                     else
+                       {
+                         asection *osec;
+
+                         osec = sec->output_section;
+                         sindx = elf_section_data (osec)->dynindx;
+                         BFD_ASSERT (sindx > 0);
+                       }
+                     outrel.r_info = ELF64_R_INFO (sindx, r_type);
+                     outrel.r_addend = relocation + rel->r_addend;
+                   }
                }
 
              sreloc = elf_section_data (input_section)->sreloc;