patches/binutils/2.15/140-arm-textrel.patch
changeset 747 d3e603e7c17c
parent 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.15/140-arm-textrel.patch	Mon Jul 28 21:32:33 2008 +0000
     1.3 @@ -0,0 +1,63 @@
     1.4 +http://sources.redhat.com/ml/binutils/2004-06/msg00010.html
     1.5 +--- binutils-2.15.90.0.3-old/bfd/elf32-arm.h	2004-04-12 14:56:33.000000000 -0500
     1.6 ++++ binutils-2.15.90.0.3/bfd/elf32-arm.h	2004-09-03 06:56:40.000000000 -0500
     1.7 +@@ -87,6 +87,8 @@
     1.8 + #endif
     1.9 + static bfd_boolean allocate_dynrelocs 
    1.10 +   PARAMS ((struct elf_link_hash_entry *h, PTR inf));
    1.11 ++static bfd_boolean elf32_arm_readonly_dynrelocs
    1.12 ++  PARAMS ((struct elf_link_hash_entry *, PTR));
    1.13 + static bfd_boolean create_got_section 
    1.14 +   PARAMS ((bfd * dynobj, struct bfd_link_info * info));
    1.15 + static bfd_boolean elf32_arm_create_dynamic_sections 
    1.16 +@@ -3531,6 +3533,37 @@
    1.17 +   return TRUE;
    1.18 + }
    1.19 + 
    1.20 ++/* Find any dynamic relocs that apply to read-only sections.  */
    1.21 ++
    1.22 ++static bfd_boolean
    1.23 ++elf32_arm_readonly_dynrelocs (h, inf)
    1.24 ++     struct elf_link_hash_entry *h;
    1.25 ++     PTR inf;
    1.26 ++{
    1.27 ++  struct elf32_arm_link_hash_entry *eh;
    1.28 ++  struct elf32_arm_relocs_copied *p;
    1.29 ++
    1.30 ++  if (h->root.type == bfd_link_hash_warning)
    1.31 ++    h = (struct elf_link_hash_entry *) h->root.u.i.link;
    1.32 ++
    1.33 ++  eh = (struct elf32_arm_link_hash_entry *) h;
    1.34 ++  for (p = eh->relocs_copied; p != NULL; p = p->next)
    1.35 ++    {
    1.36 ++      asection *s = p->section;
    1.37 ++
    1.38 ++      if (s != NULL && (s->flags & SEC_READONLY) != 0)
    1.39 ++       {
    1.40 ++         struct bfd_link_info *info = (struct bfd_link_info *) inf;
    1.41 ++
    1.42 ++         info->flags |= DF_TEXTREL;
    1.43 ++
    1.44 ++         /* Not an error, just cut short the traversal.  */
    1.45 ++         return FALSE;
    1.46 ++       }
    1.47 ++    }
    1.48 ++  return TRUE;
    1.49 ++}
    1.50 ++
    1.51 + /* Set the sizes of the dynamic sections.  */
    1.52 + 
    1.53 + static bfd_boolean
    1.54 +@@ -3740,6 +3773,12 @@
    1.55 + 	    return FALSE;
    1.56 + 	}
    1.57 + 
    1.58 ++      /* If any dynamic relocs apply to a read-only section,
    1.59 ++         then we need a DT_TEXTREL entry.  */
    1.60 ++      if ((info->flags & DF_TEXTREL) == 0)
    1.61 ++        elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs,
    1.62 ++                                (PTR) info);
    1.63 ++
    1.64 +       if ((info->flags & DF_TEXTREL) != 0)
    1.65 + 	{
    1.66 + 	  if (!add_dynamic_entry (DT_TEXTREL, 0))