bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Thu, 7 Aug 2008 20:04:32 +0000 (20:04 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Thu, 7 Aug 2008 20:04:32 +0000 (20:04 +0000)
* elf-bfd.h (elf_backend_data): Add a "rela_plts_and_copies_p" field.
* elfxx-target.h (elf_backend_rela_plts_and_copies_p): New macro.
(elfNN_bed): Use it.
* elf.c (_bfd_elf_get_synthetic_symtab): Use rela_plts_and_copies_p
instead of default_use_rela_p to choose between ".rel.plt" and
".rela.plt".
* elflink.c (_bfd_elf_create_dynamic_sections): Use
rela_plts_and_copies_p instead of default_use_rela_p to choose
between ".rel.plt" and ".rela.plt", and between ".rel.bss" and
".rela.bss".

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
bfd/elflink.c
bfd/elfxx-target.h

index 98ec7e7a70d1d41128c238fe0913ddf3969fa5e0..ea94b0255a7fd0154accc8ab944883adc8752b16 100644 (file)
@@ -1,3 +1,16 @@
+2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * elf-bfd.h (elf_backend_data): Add a "rela_plts_and_copies_p" field.
+       * elfxx-target.h (elf_backend_rela_plts_and_copies_p): New macro.
+       (elfNN_bed): Use it.
+       * elf.c (_bfd_elf_get_synthetic_symtab): Use rela_plts_and_copies_p
+       instead of default_use_rela_p to choose between ".rel.plt" and
+       ".rela.plt".
+       * elflink.c (_bfd_elf_create_dynamic_sections): Use
+       rela_plts_and_copies_p instead of default_use_rela_p to choose
+       between ".rel.plt" and ".rela.plt", and between ".rel.bss" and
+       ".rela.bss".
+
 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * elf-bfd.h (MIPS_ELF_TDATA): New elf_object_id.
index d1772557b8fb6f0b4ce68add2b6db14725b50b98..2b739f94212afaa28e7418ad2d5a78aa1cfb48c2 100644 (file)
@@ -1189,6 +1189,9 @@ struct elf_backend_data
      section.  */
   unsigned default_use_rela_p : 1;
 
+  /* True if PLT and copy relocations should be RELA by default.  */
+  unsigned rela_plts_and_copies_p : 1;
+
   /* Set if RELA relocations for a relocatable link can be handled by
      generic code.  Backends that set this flag need do nothing in the
      backend relocate_section routine for relocatable linking.  */
index 6b67e16fd43703d306ac964435a615f65d1e3a57..beb6d1b7d036211995009ce426e6be83b4b67705 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8809,7 +8809,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
 
   relplt_name = bed->relplt_name;
   if (relplt_name == NULL)
-    relplt_name = bed->default_use_rela_p ? ".rela.plt" : ".rel.plt";
+    relplt_name = bed->rela_plts_and_copies_p ? ".rela.plt" : ".rel.plt";
   relplt = bfd_get_section_by_name (abfd, relplt_name);
   if (relplt == NULL)
     return 0;
index 488f98afdb7aef2e00c16ef710e4347d10afb25a..de7f3ba40f50e6f0435ca0394ba2b32b7dd95811 100644 (file)
@@ -309,7 +309,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
     }
 
   s = bfd_make_section_with_flags (abfd,
-                                  (bed->default_use_rela_p
+                                  (bed->rela_plts_and_copies_p
                                    ? ".rela.plt" : ".rel.plt"),
                                   flags | SEC_READONLY);
   if (s == NULL
@@ -347,7 +347,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
       if (! info->shared)
        {
          s = bfd_make_section_with_flags (abfd,
-                                          (bed->default_use_rela_p
+                                          (bed->rela_plts_and_copies_p
                                            ? ".rela.bss" : ".rel.bss"),
                                           flags | SEC_READONLY);
          if (s == NULL
index 148f5cb2bce24c80a1d679508615c365be0d8447..d897c32d1fb9537330dfb4881a47d32d72f51668 100644 (file)
 #ifndef elf_backend_default_use_rela_p
 #define elf_backend_default_use_rela_p !USE_REL
 #endif
+#ifndef elf_backend_rela_plts_and_copies_p
+#define elf_backend_rela_plts_and_copies_p elf_backend_default_use_rela_p
+#endif
 
 #ifndef elf_backend_rela_normal
 #define elf_backend_rela_normal 0
@@ -718,6 +721,7 @@ static struct elf_backend_data elfNN_bed =
   elf_backend_may_use_rel_p,
   elf_backend_may_use_rela_p,
   elf_backend_default_use_rela_p,
+  elf_backend_rela_plts_and_copies_p,
   elf_backend_rela_normal,
   elf_backend_sign_extend_vma,
   elf_backend_want_got_plt,