aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2011-04-23 01:16:31 +0000
committerH.J. Lu <hjl.tools@gmail.com>2011-04-23 01:16:31 +0000
commitb70321a200b768e57b211fce3f6926b2b29dee7f (patch)
tree06aea802ab522c0722006e1063498025884f3271 /bfd/elf64-x86-64.c
parentd0c8589a6bb58649b31f62d2912f685695c81da1 (diff)
downloadgdb-b70321a200b768e57b211fce3f6926b2b29dee7f.zip
gdb-b70321a200b768e57b211fce3f6926b2b29dee7f.tar.gz
gdb-b70321a200b768e57b211fce3f6926b2b29dee7f.tar.bz2
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/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 8d00edd..a02b3e8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2314,6 +2314,11 @@ elf_x86_64_readonly_dynrelocs (struct elf_link_hash_entry *h,
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;
}
@@ -2393,7 +2398,13 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
srel = elf_section_data (p->sec)->sreloc;
srel->size += p->count * bed->s->sizeof_rela;
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;
+ }
}
}
}