aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-s390.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-01-05 19:53:14 +0100
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-01-07 22:03:07 +0100
commit431e5de3f224e94fb0d061edb3a56d8e3c3f4403 (patch)
tree3f97444a54610b059a19751130b114ee6c8417dc /bfd/elf64-s390.c
parent0e123f69da7567042903c8e6e2ad0b03b0a66e55 (diff)
downloadfsf-binutils-gdb-431e5de3f224e94fb0d061edb3a56d8e3c3f4403.zip
fsf-binutils-gdb-431e5de3f224e94fb0d061edb3a56d8e3c3f4403.tar.gz
fsf-binutils-gdb-431e5de3f224e94fb0d061edb3a56d8e3c3f4403.tar.bz2
S/390: Issue error for overflowing relocs.
Building PIE executable from non-PIC code results in broken binaries. With this patch the problem is detected at link-time. bfd/ChangeLog: 2017-01-07 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf64-s390.c (elf_s390_relocate_section): Issue error for non-PLT relocs of shared libary symbol in exectuable.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r--bfd/elf64-s390.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index bbfcd2e..edc9b86 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2701,6 +2701,18 @@ elf_s390_relocate_section (bfd *output_bfd,
case R_390_PC32:
case R_390_PC32DBL:
case R_390_PC64:
+ if (h != NULL
+ && bfd_link_pie (info)
+ && !h->def_regular)
+ {
+ _bfd_error_handler (_("%B: `%s' non-PLT reloc for symbol defined "
+ "in shared library and accessed "
+ "from executable "
+ "(rebuild file with -fPIC ?)"),
+ input_bfd, h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
/* The target of these relocs are instruction operands
residing in read-only sections. We cannot emit a runtime
reloc for it. */