diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-02-07 05:28:06 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-02-07 05:28:06 -0800 |
commit | 1952c5cd7d3d24b9647b396731bc4808a2d63d9c (patch) | |
tree | c9c5da57723dffe43b0808aa2a0f297015904f4e /bfd/elf64-x86-64.c | |
parent | 11228d29d5146828325a7f14596b9d87f7a2edf7 (diff) | |
download | gdb-1952c5cd7d3d24b9647b396731bc4808a2d63d9c.zip gdb-1952c5cd7d3d24b9647b396731bc4808a2d63d9c.tar.gz gdb-1952c5cd7d3d24b9647b396731bc4808a2d63d9c.tar.bz2 |
Issue relocation in RO section warning for -z text
This patch changes linker to issue a warning for relocation in readonly
section for -z text.
bfd/
PR ld/17935
* elf32-i386.c (elf_i386_readonly_dynrelocs): Also issue a
warning for relocation in readonly section for -z text.
(elf_i386_size_dynamic_sections): Likewise.
* elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.
(elf_x86_64_size_dynamic_sections): Likewise.
ld/testsuite/
PR ld/17935
* ld-i386/i386.exp: Run pr17935-1 and pr17935-2.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pr17935-1.d: New file.
* ld-i386/pr17935-1.s: Likewise.
* ld-i386/pr17935-2.d: Likewise.
* ld-i386/pr17935-2.s: Likewise.
* ld-x86-64/pr17935-1.d: Likewise.
* ld-x86-64/pr17935-1.s: Likewise.
* ld-x86-64/pr17935-2.d: Likewise.
* ld-x86-64/pr17935-2.s: Likewise.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 80136bf..5fd727b 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2850,8 +2850,9 @@ 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"), + if ((info->warn_shared_textrel && info->shared) + || info->error_textrel) + info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"), p->sec->owner, h->root.root.string, p->sec); @@ -3090,8 +3091,9 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, && (info->flags & DF_TEXTREL) == 0) { info->flags |= DF_TEXTREL; - if (info->warn_shared_textrel && info->shared) - info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), + if ((info->warn_shared_textrel && info->shared) + || info->error_textrel) + info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'\n"), p->sec->owner, p->sec); } } |