]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/
authorAlan Modra <amodra@gmail.com>
Mon, 6 Jun 2005 12:59:59 +0000 (12:59 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 6 Jun 2005 12:59:59 +0000 (12:59 +0000)
* elf64-pcc.c (ppc64_elf_gc_mark_hook): For the local sym in .opd
case, include addend when indexing .opd section map.
(ppc64_elf_edit_opd): Add no_opd_opt param.  Do nothing besides
clear opd_adjust array if no_opd_opt set.  Tidy code.
* elf64-ppc.h (ppc64_elf_edit_opd): Update prototype.
ld/
* emultempl/ppc64elf.em (ppc_before_allocation): Always run
ppc64_elf_edit_opd.

bfd/ChangeLog
bfd/elf64-ppc.c
ld/ChangeLog
ld/emultempl/ppc64elf.em

index 2c0feac5d5268bfa51885773470c1f40017bba54..e5095904c55d0b1079ab8ba1824adfd5522d6095 100644 (file)
@@ -1,3 +1,11 @@
+2005-06-06  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-pcc.c (ppc64_elf_gc_mark_hook): For the local sym in .opd
+       case, include addend when indexing .opd section map.
+       (ppc64_elf_edit_opd): Add no_opd_opt param.  Do nothing besides
+       clear opd_adjust array if no_opd_opt set.  Tidy code.
+       * elf64-ppc.h (ppc64_elf_edit_opd): Update prototype.
+
 2005-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * dwarf2.c (comp_unit): Fix a typo in comment.
index 04fcdc916697eff4b6933df14affc769901b3cbf..5c398b1a9f706e4130bb90c9df61c0188bfbcfd3 100644 (file)
@@ -5064,7 +5064,7 @@ ppc64_elf_gc_mark_hook (asection *sec,
          if (!rsec->gc_mark)
            _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook);
 
-         rsec = opd_sym_section[sym->st_value / 8];
+         rsec = opd_sym_section[(sym->st_value + rel->r_addend) / 8];
        }
     }
 
@@ -6155,6 +6155,7 @@ dec_dynrel_count (bfd_vma r_info,
 
 bfd_boolean
 ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
+                   bfd_boolean no_opd_opt,
                    bfd_boolean non_overlapping)
 {
   bfd *ibfd;
@@ -6184,11 +6185,14 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
        {
          /* check_relocs hasn't been called.  Must be a ld -r link
             or --just-symbols object.   */
-         opd_adjust = bfd_zalloc (obfd, amt);
+         opd_adjust = bfd_alloc (obfd, amt);
          ppc64_elf_section_data (sec)->opd.adjust = opd_adjust;
        }
       memset (opd_adjust, 0, amt);
 
+      if (no_opd_opt)
+       continue;
+
       if (sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
        continue;
 
@@ -6358,18 +6362,16 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
 
          elf_section_data (sec)->relocs = relstart;
 
-         wptr = sec->contents;
-         rptr = sec->contents;
          new_contents = sec->contents;
-
          if (add_aux_fields)
            {
              new_contents = bfd_malloc (sec->size + cnt_16b * 8);
              if (new_contents == NULL)
                return FALSE;
              need_pad = FALSE;
-             wptr = new_contents;
            }
+         wptr = new_contents;
+         rptr = sec->contents;
 
          write_rel = relstart;
          skip = FALSE;
index d4a15a86b388a6c466b1c25f1b26fccdcb561d2f..113bb8234511f567a699e5f373e666c5853540fb 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-06  Alan Modra  <amodra@bigpond.net.au>
+
+       * emultempl/ppc64elf.em (ppc_before_allocation): Always run
+       ppc64_elf_edit_opd.
+
 2005-06-05  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ldexp.c (exp_mark_used_section): Set SEC_KEEP on current
index f002cf3ca590346d9641bd38ce8045c1a781e56a..c1343b67022df2d0d2711c48f6d3db28d6020dff 100644 (file)
@@ -102,8 +102,8 @@ ppc_before_allocation (void)
 {
   if (stub_file != NULL)
     {
-      if (!no_opd_opt
-         && !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd))
+      if (!ppc64_elf_edit_opd (output_bfd, &link_info, no_opd_opt,
+                              non_overlapping_opd))
        einfo ("%X%P: can not edit %s %E\n", "opd");
 
       if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt)