* elf.c (_bfd_elf_rela_local_sym): Only call
authorJakub Jelinek <jakub@redhat.com>
Fri, 7 Dec 2001 11:12:18 +0000 (11:12 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 7 Dec 2001 11:12:18 +0000 (11:12 +0000)
_bfd_merged_section_offset if merge_info is non-NULL.
(_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New.
* elf-bfd.h (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New
prototypes.
* elf32-arm.h (elf32_arm_final_link_relocate): Use
_bfd_elf_section_offset.
(elf32_arm_relocate_section): Use _bfd_elf_rel_local_sym.
* elf32-i386.c (elf_i386_relocate_section): Use
_bfd_elf_section_offset and _bfd_elf_rel_local_sym.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf32-sparc.c (elf32_sparc_relocate_section): Use
_bfd_elf_section_offset.
* elf32-cris.c (cris_elf_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-mips.c (mips_elf_create_dynamic_relocation): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
* elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.

20 files changed:
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-arm.h
bfd/elf32-cris.c
bfd/elf32-hppa.c
bfd/elf32-i370.c
bfd/elf32-i386.c
bfd/elf32-m68k.c
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-sparc.c
bfd/elf64-alpha.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
bfd/elfxx-ia64.c

index 0086e7b..a87aa9f 100644 (file)
@@ -1,3 +1,32 @@
+2001-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf.c (_bfd_elf_rela_local_sym): Only call
+       _bfd_merged_section_offset if merge_info is non-NULL.
+       (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New.
+       * elf-bfd.h (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New
+       prototypes.
+       * elf32-arm.h (elf32_arm_final_link_relocate): Use
+       _bfd_elf_section_offset.
+       (elf32_arm_relocate_section): Use _bfd_elf_rel_local_sym.
+       * elf32-i386.c (elf_i386_relocate_section): Use
+       _bfd_elf_section_offset and _bfd_elf_rel_local_sym.
+       * elf32-sh.c (sh_elf_relocate_section): Likewise.
+       * elf32-sparc.c (elf32_sparc_relocate_section): Use
+       _bfd_elf_section_offset.
+       * elf32-cris.c (cris_elf_relocate_section): Likewise.
+       * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+       * elf32-i370.c (i370_elf_relocate_section): Likewise.
+       * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+       * elf32-mips.c (mips_elf_create_dynamic_relocation): Likewise.
+       * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+       * elf32-s390.c (elf_s390_relocate_section): Likewise.
+       * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+       * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+       * elf64-s390.c (elf_s390_relocate_section): Likewise.
+       * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+       * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
+
 2001-12-07  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-hppa.c (clobber_millicode_symbols): Don't do anything if
index 026d8cf..3323aaa 100644 (file)
@@ -1142,6 +1142,10 @@ extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
   PARAMS ((const Elf_Internal_Rela *));
 extern bfd_vma _bfd_elf_rela_local_sym
   PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *));
+extern bfd_vma _bfd_elf_rel_local_sym
+  PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma));
+extern bfd_vma _bfd_elf_section_offset
+  PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma));
 
 extern unsigned long bfd_elf_hash
   PARAMS ((const char *));
index 81923d1..9c4c087 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6393,7 +6393,8 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
                + sec->output_offset
                + sym->st_value);
   if ((sec->flags & SEC_MERGE)
-      && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+      && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+      && elf_section_data (sec)->merge_info)
     {
       asection *msec;
 
@@ -6408,3 +6409,37 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
     }
   return relocation;
 }
+
+bfd_vma
+_bfd_elf_rel_local_sym (abfd, sym, psec, addend)
+     bfd *abfd;
+     Elf_Internal_Sym *sym;
+     asection **psec;
+     bfd_vma addend;
+{     
+  asection *sec = *psec;
+
+  if (elf_section_data (sec)->merge_info == NULL)
+    return sym->st_value + addend;
+
+  return _bfd_merged_section_offset (abfd, psec,
+                                    elf_section_data (sec)->merge_info,
+                                    sym->st_value + addend, (bfd_vma) 0);
+}
+
+bfd_vma
+_bfd_elf_section_offset (abfd, info, sec, offset)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *sec;
+     bfd_vma offset;
+{
+  struct bfd_elf_section_data *sec_data;
+
+  sec_data = elf_section_data (sec);
+  if (sec_data->stab_info != NULL)
+    return _bfd_stab_section_offset
+          (abfd, &elf_hash_table (info)->stab_info,
+           sec, &sec_data->stab_info, offset);
+  return offset;
+}
index 3ef2c19..26e0b75 100644 (file)
@@ -1149,22 +1149,11 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
 
          skip = false;
 
-         if (elf_section_data (input_section)->stab_info == NULL)
-           outrel.r_offset = rel->r_offset;
-         else
-           {
-             bfd_vma off;
-
-             off = (_bfd_stab_section_offset
-                    (output_bfd, &elf_hash_table (info)->stab_info,
-                     input_section,
-                     & elf_section_data (input_section)->stab_info,
-                     rel->r_offset));
-             if (off == (bfd_vma) -1)
-               skip = true;
-             outrel.r_offset = off;
-           }
-
+         outrel.r_offset =
+           _bfd_elf_section_offset (output_bfd, info, input_section,
+                                    rel->r_offset);
+         if (outrel.r_offset == (bfd_vma) -1)
+           skip = true;
          outrel.r_offset += (input_section->output_section->vma
                              + input_section->output_offset);
 
@@ -1892,9 +1881,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
                }
              msec = sec;
              addend =
-               _bfd_merged_section_offset (output_bfd, &msec,
-                                           elf_section_data (sec)->merge_info,
-                                           sym->st_value + addend, (bfd_vma) 0)
+               _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
                - relocation;
              addend += msec->output_section->vma + msec->output_offset;
              value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask);
index 674a7b1..5f7c667 100644 (file)
@@ -1283,22 +1283,11 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index 0aaf346..934c8e8 100644 (file)
@@ -3949,23 +3949,11 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
                 are copied into the output file to be resolved at run
                 time.  */
 
-             outrel.r_offset = rel->r_offset;
              outrel.r_addend = rel->r_addend;
-             skip = false;
-             if (elf_section_data (input_section)->stab_info != NULL)
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &htab->elf.stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             skip = (outrel.r_offset == (bfd_vma) -1);
              outrel.r_offset += (input_section->output_offset
                                  + input_section->output_section->vma);
 
index 3b9ad34..315689e 100644 (file)
@@ -1486,22 +1486,11 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index 9299b1c..9fae870 100644 (file)
@@ -1789,9 +1789,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
              addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
              msec = sec;
              addend =
-               _bfd_merged_section_offset (output_bfd, &msec,
-                                           elf_section_data (sec)->merge_info,
-                                           sym->st_value + addend, (bfd_vma) 0)
+               _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
                - relocation;
              addend += msec->output_section->vma + msec->output_offset;
              bfd_put_32 (input_bfd, addend, contents + rel->r_offset);
@@ -2009,19 +2007,11 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, htab->elf.stab_info, input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index 68f4a23..e4b41be 100644 (file)
@@ -1680,22 +1680,11 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index 78e89b1..ff758fa 100644 (file)
@@ -6358,29 +6358,10 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
              < sreloc->_raw_size);
 
   skip = false;
-
-  /* We begin by assuming that the offset for the dynamic relocation
-     is the same as for the original relocation.  We'll adjust this
-     later to reflect the correct output offsets.  */
-  if (elf_section_data (input_section)->stab_info == NULL)
-    outrel.r_offset = rel->r_offset;
-  else
-    {
-      /* Except that in a stab section things are more complex.
-        Because we compress stab information, the offset given in the
-        relocation may not be the one we want; we must let the stabs
-        machinery tell us the offset.  */
-      outrel.r_offset
-       = (_bfd_stab_section_offset
-          (output_bfd, &elf_hash_table (info)->stab_info,
-           input_section,
-           &elf_section_data (input_section)->stab_info,
-           rel->r_offset));
-      /* If we didn't need the relocation at all, this value will be
-        -1.  */
-      if (outrel.r_offset == (bfd_vma) -1)
-       skip = true;
-    }
+  outrel.r_offset =
+    _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset);
+  if (outrel.r_offset == (bfd_vma) -1)
+    skip = true;
 
   /* If we've decided to skip this relocation, just output an empty
      record.  Note that R_MIPS_NONE == 0, so that this call to memset
index 2af8400..e174603 100644 (file)
@@ -3210,22 +3210,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index f608fb0..ac1c6d0 100644 (file)
@@ -1891,19 +1891,11 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 
               skip = false;
 
-              if (elf_section_data (input_section)->stab_info == NULL)
-                outrel.r_offset = rel->r_offset;
-              else
-                {
-                  off = (_bfd_stab_section_offset
-                         (output_bfd, htab->elf.stab_info, input_section,
-                          &elf_section_data (input_section)->stab_info,
-                          rel->r_offset));
-                  if (off == (bfd_vma) -1)
-                    skip = true;
-                  outrel.r_offset = off;
-                }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
               outrel.r_offset += (input_section->output_section->vma
                                   + input_section->output_offset);
 
index 74b725a..9fe9873 100644 (file)
@@ -3101,9 +3101,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
               addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
               msec = sec;
               addend =
-               _bfd_merged_section_offset (output_bfd, &msec,
-                                           elf_section_data (sec)->merge_info,
-                                           sym->st_value + addend, (bfd_vma) 0)
+               _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
                - relocation;
              addend += msec->output_section->vma + msec->output_offset;
              bfd_put_32 (input_bfd, addend, contents + rel->r_offset);
@@ -3284,22 +3282,11 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index 60a4dc7..6a82d72 100644 (file)
@@ -1448,22 +1448,11 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rel->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rel->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
-
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
index 950d051..e372046 100644 (file)
@@ -3534,7 +3534,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_ALPHA_REFQUAD:
          {
            Elf_Internal_Rela outrel;
-           boolean skip;
 
            /* Careful here to remember RELATIVE relocations for global
               variables for symbolic shared objects.  */
@@ -3569,25 +3568,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
                BFD_ASSERT(srel != NULL);
              }
 
-           skip = false;
-
-           if (elf_section_data (input_section)->stab_info == NULL)
-             outrel.r_offset = rel->r_offset;
-           else
-             {
-               bfd_vma off;
-
-               off = (_bfd_stab_section_offset
-                      (output_bfd, &elf_hash_table (info)->stab_info,
-                       input_section,
-                       &elf_section_data (input_section)->stab_info,
-                       rel->r_offset));
-               if (off == (bfd_vma) -1)
-                 skip = true;
-               outrel.r_offset = off;
-             }
-
-           if (! skip)
+           outrel.r_offset =
+             _bfd_elf_section_offset (output_bfd, info, input_section,
+                                      rel->r_offset);
+           if (outrel.r_offset != (bfd_vma) -1)
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
            else
index 02d2913..4772254 100644 (file)
@@ -3494,20 +3494,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, htab->elf.stab_info, input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
 
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
index 222e1e4..da037ff 100644 (file)
@@ -1891,18 +1891,11 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 
               skip = false;
 
-              if (elf_section_data (input_section)->stab_info == NULL)
-                outrel.r_offset = rel->r_offset;
-              else
-                {
-                  off = (_bfd_stab_section_offset
-                         (output_bfd, htab->elf.stab_info, input_section,
-                          &elf_section_data (input_section)->stab_info,
-                          rel->r_offset));
-                  if (off == (bfd_vma) -1)
-                    skip = true;
-                  outrel.r_offset = off;
-                }
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rel->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
 
               outrel.r_offset += (input_section->output_section->vma
                                   + input_section->output_offset);
index 9a91816..50b0cd5 100644 (file)
@@ -2184,21 +2184,11 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
                skip = false;
 
-               if (elf_section_data (input_section)->stab_info == NULL)
-                 outrel.r_offset = rel->r_offset;
-               else
-                 {
-                   bfd_vma off;
-
-                   off = (_bfd_stab_section_offset
-                          (output_bfd, &elf_hash_table (info)->stab_info,
-                           input_section,
-                           &elf_section_data (input_section)->stab_info,
-                           rel->r_offset));
-                   if (off == MINUS_ONE)
-                     skip = true;
-                   outrel.r_offset = off;
-                 }
+               outrel.r_offset =
+                 _bfd_elf_section_offset (output_bfd, info, input_section,
+                                          rel->r_offset);
+               if (outrel.r_offset == (bfd_vma) -1)
+                 skip = true;
 
                outrel.r_offset += (input_section->output_section->vma
                                    + input_section->output_offset);
index 349540f..9f7fdd3 100644 (file)
@@ -1473,21 +1473,11 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
 
              skip = false;
 
-             if (elf_section_data (input_section)->stab_info == NULL)
-               outrel.r_offset = rela->r_offset;
-             else
-               {
-                 bfd_vma off;
-
-                 off = (_bfd_stab_section_offset
-                        (output_bfd, &elf_hash_table (info)->stab_info,
-                         input_section,
-                         &elf_section_data (input_section)->stab_info,
-                         rela->r_offset));
-                 if (off == (bfd_vma) -1)
-                   skip = true;
-                 outrel.r_offset = off;
-               }
+             outrel.r_offset =
+               _bfd_elf_section_offset (output_bfd, info, input_section,
+                                        rela->r_offset);
+             if (outrel.r_offset == (bfd_vma) -1)
+               skip = true;
 
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
index 2e34a30..ca1d7e1 100644 (file)
@@ -3014,33 +3014,19 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
 {
   Elf_Internal_Rela outrel;
 
-  outrel.r_offset = (sec->output_section->vma
-                    + sec->output_offset
-                    + offset);
+  offset += sec->output_section->vma + sec->output_offset;
 
   BFD_ASSERT (dynindx != -1);
   outrel.r_info = ELFNN_R_INFO (dynindx, type);
   outrel.r_addend = addend;
-
-  if (elf_section_data (sec)->stab_info != NULL)
+  outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset);
+  if (outrel.r_offset == (bfd_vma) -1)
     {
-      /* This may be NULL for linker-generated relocations, as it is
-        inconvenient to pass all the bits around.  And this shouldn't
-        happen.  */
-      BFD_ASSERT (info != NULL);
-
-      offset = (_bfd_stab_section_offset
-               (abfd, &elf_hash_table (info)->stab_info, sec,
-                &elf_section_data (sec)->stab_info, offset));
-      if (offset == (bfd_vma) -1)
-       {
-         /* Run for the hills.  We shouldn't be outputting a relocation
-            for this.  So do what everyone else does and output a no-op.  */
-         outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
-         outrel.r_addend = 0;
-         offset = 0;
-       }
-      outrel.r_offset = offset;
+      /* Run for the hills.  We shouldn't be outputting a relocation
+        for this.  So do what everyone else does and output a no-op.  */
+      outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
+      outrel.r_addend = 0;
+      outrel.r_offset = 0;
     }
 
   bfd_elfNN_swap_reloca_out (abfd, &outrel,