* elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Aug 2000 17:42:21 +0000 (17:42 +0000)
committerJakub Jelinek <jakub@redhat.com>
Wed, 16 Aug 2000 17:42:21 +0000 (17:42 +0000)
for undefined symbols to be the beginning of the section.

* elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
four extra entries at the beginning of the .rela.plt section.
(sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
section to account for the four reserved entries in the .plt section.

bfd/ChangeLog
bfd/elf64-sparc.c

index c25b13984a6d8b39349fe4c37e1c05d3d319fc4f..67b5e85e1d8f405f2fd5f3a33900898871f2d7b2 100644 (file)
@@ -1,3 +1,13 @@
+2000-08-16  Andrew Macleod  <amacleod@cygnus.com>
+
+       * elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
+       for undefined symbols to be the beginning of the section.
+
+       * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
+       four extra entries at the beginning of the .rela.plt section.
+       (sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
+       section to account for the four reserved entries in the .plt section.
+
 2000-08-15  Geoffrey Keating  <geoffk@cygnus.com>
 
        * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Add ori r0,r0,0
index b2b8cbf9ec0b4614be53174e4592292ee6c719a9..cef378893173405bea564383129d4d79e875788d 100644 (file)
@@ -1557,12 +1557,6 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
       s = bfd_get_section_by_name (dynobj, ".rela.plt");
       BFD_ASSERT (s != NULL);
 
-      /* The first plt entries are reserved, and the relocations must
-        pair up exactly.  */
-      if (s->_raw_size == 0)
-       s->_raw_size += (PLT_HEADER_SIZE/PLT_ENTRY_SIZE
-                        * sizeof (Elf64_External_Rela));
-
       s->_raw_size += sizeof (Elf64_External_Rela);
 
       /* The procedure linkage table size is bounded by the magnitude
@@ -2079,7 +2073,15 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                      (!info->shared || info->no_undefined
                       || ELF_ST_VISIBILITY (h->other)))))
                return false;
-             relocation = 0;
+
+             /* To avoid generating warning messages about truncated
+                relocations, set the relocation's address to be the same as
+                the start of this section.  */
+
+             if (input_section->output_section != NULL)
+               relocation = input_section->output_section->vma;
+             else
+               relocation = 0;
            }
        }
 
@@ -2686,9 +2688,14 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
       rela.r_offset += (splt->output_section->vma + splt->output_offset);
       rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
 
+      /* Adjust for the first 4 reserved elements in the .plt section
+        when setting the offset in the .rela.plt section.
+        Sun forgot to read their own ABI and copied elf32-sparc behaviour,
+        thus .plt[4] has corresponding .rela.plt[0] and so on.  */
+
       bfd_elf64_swap_reloca_out (output_bfd, &rela,
                                 ((Elf64_External_Rela *) srela->contents
-                                 + h->plt.offset));
+                                 + (h->plt.offset - 4)));
 
       if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
        {
This page took 0.032861 seconds and 4 git commands to generate.