aboutsummaryrefslogtreecommitdiff
path: root/bfd
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
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')
-rw-r--r--bfd/elf32-s390.c21
-rw-r--r--bfd/elf64-s390.c21
2 files changed, 32 insertions, 10 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)
{
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index b1f5b89..08e726f 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3197,8 +3197,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if (insn1 != 0x0004)
- invalid_tls_insn (input_bfd, input_section, rel);
- ry = 0;
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn0 & 0xff00f000) == 0xe3000000)
/* lg %rx,0(%ry,0) -> sllg %rx,%ry,0 */
ry = (insn0 & 0x000f0000);
@@ -3212,7 +3214,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* lg %rx,0(%r12,%ry) -> sllg %rx,%ry,0 */
ry = (insn0 & 0x0000f000) << 4;
else
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
insn0 = 0xeb000000 | (insn0 & 0x00f00000) | ry;
insn1 = 0x000d;
bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
@@ -3226,7 +3231,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if ((insn0 & 0xffff0000) != 0xc0e50000)
- 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))
{
/* GD->LE transition.
@@ -3253,7 +3261,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
/* LD->LE transition.
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
insn0 = 0xc0040000;