]> git.pld-linux.org Git - packages/binutils.git/blame - binutils-warn_ro_relocs.patch
- emit proper warning about relocation in shared objects' text segment
[packages/binutils.git] / binutils-warn_ro_relocs.patch
CommitLineData
4514cdb7
PS
1commit cd83a0f5f7496853f21ae956ffcc3759adee1c1f
2Author: H.J. Lu <hjl.tools@gmail.com>
3Date: 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
13diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
14index 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 }
33diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
34index 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 }
This page took 0.052622 seconds and 4 git commands to generate.