diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2011-04-23 01:16:30 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2011-04-23 01:16:30 +0000 |
commit | f3119ecdf6fe0200b75472f70d179badcace10bb (patch) | |
tree | bf91802e7e67468cd3a8de66c9692e3f8df1f9f4 /bfd/elf32-i386.c | |
parent | 1d8f98d1b279332fdcd88b2c3a5147dbecf57ae2 (diff) | |
download | binutils-redhat-f3119ecdf6fe0200b75472f70d179badcace10bb.tar.gz |
Warn relocation in readonly section in a shared object.
2011-04-22 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_readonly_dynrelocs): Warn relocation
in readonly section in a shared object.
(elf_i386_size_dynamic_sections): Likewise.
* elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.
(elf_x86_64_size_dynamic_sections): Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index bb79f897d7..e32ec831c7 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2399,6 +2399,11 @@ elf_i386_readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf) info->flags |= DF_TEXTREL; + if (info->warn_shared_textrel && info->shared) + info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'.\n"), + p->sec->owner, h->root.root.string, + p->sec); + /* Not an error, just cut short the traversal. */ return FALSE; } @@ -2482,7 +2487,13 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, srel = elf_section_data (p->sec)->sreloc; srel->size += p->count * sizeof (Elf32_External_Rel); if ((p->sec->output_section->flags & SEC_READONLY) != 0) - info->flags |= DF_TEXTREL; + { + info->flags |= DF_TEXTREL; + if (info->warn_shared_textrel && info->shared) + info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), + p->sec->owner, p->sec); + break; + } } } } |