aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-s390.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-06-09 11:19:01 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-06-12 10:54:55 +0200
commit3704e3589d3d187fbf76e688388b1a92fd627c8d (patch)
tree7f50f883b900e10de9f83b972910c4b6ea1c7d67 /bfd/elf32-s390.c
parentfd0219988dada5b4ddb04b691f71c9acdd87b739 (diff)
downloadgdb-3704e3589d3d187fbf76e688388b1a92fd627c8d.zip
gdb-3704e3589d3d187fbf76e688388b1a92fd627c8d.tar.gz
gdb-3704e3589d3d187fbf76e688388b1a92fd627c8d.tar.bz2
S/390: Return with an error for broken tls rewrites
bfd/ChangeLog: 2017-06-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf32-s390.c (elf_s390_relocate_section): Return false in case the rewriting fails. * elf64-s390.c (elf_s390_relocate_section): Likewise.
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r--bfd/elf32-s390.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index fc4992e..c26bdcf 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3231,7 +3231,6 @@ elf_s390_relocate_section (bfd *output_bfd,
unsigned int insn, ry;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- ry = 0;
if ((insn & 0xff00f000) == 0x58000000)
/* l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x000f0000);
@@ -3245,7 +3244,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x0000f000) << 4;
else
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
insn = 0x18000700 | (insn & 0x00f00000) | ry;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
@@ -3258,7 +3260,10 @@ elf_s390_relocate_section (bfd *output_bfd,
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000 &&
(insn & 0xff000000) != 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
{
if ((insn & 0xff000000) == 0x0d000000)
@@ -3287,7 +3292,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* If basr is used in the pic case to invoke
_tls_get_offset, something went wrong before. */
if ((insn & 0xff000000) == 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn & 0xff000000) == 0x4d000000)
{
@@ -3317,7 +3325,10 @@ elf_s390_relocate_section (bfd *output_bfd,
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000 &&
(insn & 0xff000000) != 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn & 0xff000000) == 0x0d000000)
{