]>
Commit | Line | Data |
---|---|---|
4514cdb7 PS |
1 | commit cd83a0f5f7496853f21ae956ffcc3759adee1c1f |
2 | Author: H.J. Lu <hjl.tools@gmail.com> | |
3 | Date: Wed Jun 1 19:42:00 2011 +0000 | |
4 | ||
5 | Properly warn relocation in readonly section in a shared object. | |
6 | ||
7 | 2011-06-01 H.J. Lu <hongjiu.lu@intel.com> | |
8 | ||
9 | * elf32-i386.c (elf_i386_size_dynamic_sections): Properly warn | |
10 | relocation in readonly section in a shared object. | |
11 | * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise. | |
12 | ||
13 | diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c | |
14 | index ee1511f..eea2263 100644 | |
15 | --- a/bfd/elf32-i386.c | |
16 | +++ b/bfd/elf32-i386.c | |
17 | @@ -2488,13 +2488,13 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | |
18 | { | |
19 | srel = elf_section_data (p->sec)->sreloc; | |
20 | srel->size += p->count * sizeof (Elf32_External_Rel); | |
21 | - if ((p->sec->output_section->flags & SEC_READONLY) != 0) | |
22 | + if ((p->sec->output_section->flags & SEC_READONLY) != 0 | |
23 | + && (info->flags & DF_TEXTREL) == 0) | |
24 | { | |
25 | info->flags |= DF_TEXTREL; | |
26 | if (info->warn_shared_textrel && info->shared) | |
27 | info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), | |
28 | p->sec->owner, p->sec); | |
29 | - break; | |
30 | } | |
31 | } | |
32 | } | |
33 | diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c | |
34 | index 5cbaff8..9d6d4a4 100644 | |
35 | --- a/bfd/elf64-x86-64.c | |
36 | +++ b/bfd/elf64-x86-64.c | |
37 | @@ -2399,13 +2399,13 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, | |
38 | { | |
39 | srel = elf_section_data (p->sec)->sreloc; | |
40 | srel->size += p->count * bed->s->sizeof_rela; | |
41 | - if ((p->sec->output_section->flags & SEC_READONLY) != 0) | |
42 | + if ((p->sec->output_section->flags & SEC_READONLY) != 0 | |
43 | + && (info->flags & DF_TEXTREL) == 0) | |
44 | { | |
45 | info->flags |= DF_TEXTREL; | |
46 | if (info->warn_shared_textrel && info->shared) | |
47 | info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), | |
48 | p->sec->owner, p->sec); | |
49 | - break; | |
50 | } | |
51 | } | |
52 | } |