Initial revision
[openwrt/staging/dedeckeh.git] / openwrt / toolchain / binutils / 2.15.92.0.2 / 600-arm-textrel.patch
1 http://sources.redhat.com/ml/binutils/2004-06/msg00010.html
2 --- binutils-2.15.90.0.3-old/bfd/elf32-arm.h 2004-04-12 14:56:33.000000000 -0500
3 +++ binutils-2.15.90.0.3/bfd/elf32-arm.h 2004-09-03 06:56:40.000000000 -0500
4 @@ -3531,6 +3533,37 @@
5 return TRUE;
6 }
7
8 +/* Find any dynamic relocs that apply to read-only sections. */
9 +
10 +static bfd_boolean
11 +elf32_arm_readonly_dynrelocs (h, inf)
12 + struct elf_link_hash_entry *h;
13 + PTR inf;
14 +{
15 + struct elf32_arm_link_hash_entry *eh;
16 + struct elf32_arm_relocs_copied *p;
17 +
18 + if (h->root.type == bfd_link_hash_warning)
19 + h = (struct elf_link_hash_entry *) h->root.u.i.link;
20 +
21 + eh = (struct elf32_arm_link_hash_entry *) h;
22 + for (p = eh->relocs_copied; p != NULL; p = p->next)
23 + {
24 + asection *s = p->section;
25 +
26 + if (s != NULL && (s->flags & SEC_READONLY) != 0)
27 + {
28 + struct bfd_link_info *info = (struct bfd_link_info *) inf;
29 +
30 + info->flags |= DF_TEXTREL;
31 +
32 + /* Not an error, just cut short the traversal. */
33 + return FALSE;
34 + }
35 + }
36 + return TRUE;
37 +}
38 +
39 /* Set the sizes of the dynamic sections. */
40
41 static bfd_boolean
42 @@ -3740,6 +3773,12 @@
43 return FALSE;
44 }
45
46 + /* If any dynamic relocs apply to a read-only section,
47 + then we need a DT_TEXTREL entry. */
48 + if ((info->flags & DF_TEXTREL) == 0)
49 + elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs,
50 + (PTR) info);
51 +
52 if ((info->flags & DF_TEXTREL) != 0)
53 {
54 if (!add_dynamic_entry (DT_TEXTREL, 0))