* elf64-ppc.c (opd_entry_value): Handle --just-symbols objects.
authorAlan Modra <amodra@gmail.com>
Tue, 19 Oct 2004 12:00:58 +0000 (12:00 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 19 Oct 2004 12:00:58 +0000 (12:00 +0000)
(ppc64_elf_edit_opd): Likewise.

bfd/ChangeLog
bfd/elf64-ppc.c

index 6fb4b0537d59f63db9b4bb61cb13719b4eebabda..e40eda00f4258e44de82a59ac4b2d15d2146c00f 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (opd_entry_value): Handle --just-symbols objects.
+       (ppc64_elf_edit_opd): Likewise.
+
 2004-10-18  Mark Mitchell  <mark@codesourcery.com>
 
        * elfarm-nabi.c (ELF_DYNAMIC_SEC_FLAGS): Add comment.
index 6f30194e6ada7792a52d21ff438ee26bd9e03778..db0bc8f53b023a1c85cb2564d5be5edac7cb2427 100644 (file)
@@ -4698,6 +4698,32 @@ opd_entry_value (asection *opd_sec,
   bfd *opd_bfd = opd_sec->owner;
   Elf_Internal_Rela *lo, *hi, *look;
 
+  /* No relocs implies we are linking a --just-symbols object.  */
+  if (opd_sec->reloc_count == 0)
+    {
+      bfd_vma val;
+
+      if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
+       return (bfd_vma) -1;
+      
+      if (code_sec != NULL)
+       {
+         asection *sec, *likely = NULL;
+         for (sec = opd_bfd->sections; sec != NULL; sec = sec->next)
+           if (sec->vma <= val
+               && (sec->flags & SEC_LOAD) != 0
+               && (sec->flags & SEC_ALLOC) != 0)
+             likely = sec;
+         if (likely != NULL)
+           {
+             *code_sec = likely;
+             if (code_off != NULL)
+               *code_off = val - likely->vma;
+           }
+       }
+      return val;
+    }
+
   /* Go find the opd reloc at the sym address.  */
   lo = _bfd_elf_link_read_relocs (opd_bfd, opd_sec, NULL, NULL, TRUE);
   BFD_ASSERT (lo != NULL);
@@ -5899,13 +5925,16 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
       opd_adjust = get_opd_info (sec);
       if (opd_adjust == NULL)
        {
-         /* Must be a ld -r link.  ie. check_relocs hasn't been
-            called.  */
+         /* check_relocs hasn't been called.  Must be a ld -r link
+            or --just-symbols object.   */
          opd_adjust = bfd_zalloc (obfd, amt);
          ppc64_elf_section_data (sec)->opd.adjust = opd_adjust;
        }
       memset (opd_adjust, 0, amt);
 
+      if (sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+       continue;
+
       if (sec->output_section == bfd_abs_section_ptr)
        continue;