mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 10:34:21 +08:00
IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
as does not accept instructions like brasl %r0,.-0x100000000, because of two problems with the generic overflow check: 1. PCRel32 operands are signed, but are treated as unsigned. 2. The allowed range for these operands is [-(1 << 32), (1 << 32) - 1], and not [-(1 << 31), (1 << 31) - 1]. Fix both by disabling the generic overflow check - it's not needed, because s390_insert_operand () performs its own. gas/ * config/tc-s390.c (md_gather_operands): Set fx_no_overflow. * testsuite/gas/s390/s390.exp: Add zarch-z900-err. * testsuite/gas/s390/esa-z900.d: New test. * testsuite/gas/s390/esa-z900.s: New test. * testsuite/gas/s390/zarch-z900-err.l: New test. * testsuite/gas/s390/zarch-z900-err.s: New test.
This commit is contained in:

committed by
Andreas Krebbel

parent
77399b5298
commit
0cfd6cffde
@ -1619,6 +1619,7 @@ md_gather_operands (char *str,
|
|||||||
md_apply_fix. */
|
md_apply_fix. */
|
||||||
for (i = 0; i < fc; i++)
|
for (i = 0; i < fc; i++)
|
||||||
{
|
{
|
||||||
|
fixS *fixP;
|
||||||
|
|
||||||
if (fixups[i].opindex < 0)
|
if (fixups[i].opindex < 0)
|
||||||
{
|
{
|
||||||
@ -1633,7 +1634,6 @@ md_gather_operands (char *str,
|
|||||||
if (fixups[i].reloc != BFD_RELOC_UNUSED)
|
if (fixups[i].reloc != BFD_RELOC_UNUSED)
|
||||||
{
|
{
|
||||||
reloc_howto_type *reloc_howto;
|
reloc_howto_type *reloc_howto;
|
||||||
fixS *fixP;
|
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
|
reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
|
||||||
@ -1661,10 +1661,14 @@ md_gather_operands (char *str,
|
|||||||
fixP->fx_pcrel_adjust = operand->shift / 8;
|
fixP->fx_pcrel_adjust = operand->shift / 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fix_new_exp (frag_now, f - frag_now->fr_literal, 4, &fixups[i].exp,
|
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, 4,
|
||||||
|
&fixups[i].exp,
|
||||||
(operand->flags & S390_OPERAND_PCREL) != 0,
|
(operand->flags & S390_OPERAND_PCREL) != 0,
|
||||||
((bfd_reloc_code_real_type)
|
((bfd_reloc_code_real_type)
|
||||||
(fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
|
(fixups[i].opindex + (int) BFD_RELOC_UNUSED)));
|
||||||
|
/* s390_insert_operand () does the range checking. */
|
||||||
|
if (operand->flags & S390_OPERAND_PCREL)
|
||||||
|
fixP->fx_no_overflow = 1;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,10 @@ Disassembly of section .text:
|
|||||||
.*: c0 f4 00 00 00 00 [ ]*jg 102 <foo\+0x102>
|
.*: c0 f4 00 00 00 00 [ ]*jg 102 <foo\+0x102>
|
||||||
.*: c0 65 00 00 00 00 [ ]*brasl %r6,108 <foo\+0x108>
|
.*: c0 65 00 00 00 00 [ ]*brasl %r6,108 <foo\+0x108>
|
||||||
.*: c0 65 00 00 00 00 [ ]*brasl %r6,10e <foo\+0x10e>
|
.*: c0 65 00 00 00 00 [ ]*brasl %r6,10e <foo\+0x10e>
|
||||||
|
.*: c0 65 80 00 00 00 [ ]*brasl %r6,114 <foo\+0x114>
|
||||||
|
.*: c0 65 80 00 00 00 [ ]*brasl %r6,11a <foo\+0x11a>
|
||||||
|
.*: c0 65 7f ff ff ff [ ]*brasl %r6,11e <foo\+0x11e>
|
||||||
|
.*: c0 65 7f ff ff ff [ ]*brasl %r6,124 <foo\+0x124>
|
||||||
.*: 01 0b [ ]*tam
|
.*: 01 0b [ ]*tam
|
||||||
.*: 01 0c [ ]*sam24
|
.*: 01 0c [ ]*sam24
|
||||||
.*: 01 0d [ ]*sam31
|
.*: 01 0d [ ]*sam31
|
||||||
@ -62,7 +66,7 @@ Disassembly of section .text:
|
|||||||
.*: b9 97 00 69 [ ]*dlr %r6,%r9
|
.*: b9 97 00 69 [ ]*dlr %r6,%r9
|
||||||
.*: b9 98 00 69 [ ]*alcr %r6,%r9
|
.*: b9 98 00 69 [ ]*alcr %r6,%r9
|
||||||
.*: b9 99 00 69 [ ]*slbr %r6,%r9
|
.*: b9 99 00 69 [ ]*slbr %r6,%r9
|
||||||
.*: c0 60 00 00 00 00 [ ]*larl %r6,136 <foo\+0x136>
|
.*: c0 60 00 00 00 00 [ ]*larl %r6,14e <foo\+0x14e>
|
||||||
.*: e3 65 af ff 00 1e [ ]*lrv %r6,4095\(%r5,%r10\)
|
.*: e3 65 af ff 00 1e [ ]*lrv %r6,4095\(%r5,%r10\)
|
||||||
.*: e3 65 af ff 00 1f [ ]*lrvh %r6,4095\(%r5,%r10\)
|
.*: e3 65 af ff 00 1f [ ]*lrvh %r6,4095\(%r5,%r10\)
|
||||||
.*: e3 65 af ff 00 3e [ ]*strv %r6,4095\(%r5,%r10\)
|
.*: e3 65 af ff 00 3e [ ]*strv %r6,4095\(%r5,%r10\)
|
||||||
|
@ -46,6 +46,10 @@ foo:
|
|||||||
brul .
|
brul .
|
||||||
brasl %r6,.
|
brasl %r6,.
|
||||||
jasl %r6,.
|
jasl %r6,.
|
||||||
|
brasl %r6,.-0x100000000
|
||||||
|
jasl %r6,.-0x100000000
|
||||||
|
brasl %r6,.+0xfffffffe
|
||||||
|
jasl %r6,.+0xfffffffe
|
||||||
tam
|
tam
|
||||||
sam24
|
sam24
|
||||||
sam31
|
sam31
|
||||||
|
@ -20,6 +20,7 @@ if [expr [istarget "s390-*-*"] || [istarget "s390x-*-*"]] then {
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
run_dump_test "zarch-z900" "{as -m64}"
|
run_dump_test "zarch-z900" "{as -m64}"
|
||||||
|
run_list_test "zarch-z900-err" "-march=z900"
|
||||||
run_dump_test "zarch-z990" "{as -m64} {as -march=z990}"
|
run_dump_test "zarch-z990" "{as -m64} {as -march=z990}"
|
||||||
run_list_test "zarch-z990-symbol-lay" "-m64 -march=z990"
|
run_list_test "zarch-z990-symbol-lay" "-m64 -march=z990"
|
||||||
run_dump_test "zarch-z9-109" "{as -m64} {as -march=z9-109}"
|
run_dump_test "zarch-z9-109" "{as -m64} {as -march=z9-109}"
|
||||||
|
3
gas/testsuite/gas/s390/zarch-z900-err.l
Normal file
3
gas/testsuite/gas/s390/zarch-z900-err.l
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.*: Assembler messages:
|
||||||
|
.*:3: Error: operand out of range \(fffffffefffffffe not between 0 and 4294967294\)
|
||||||
|
.*:4: Error: operand out of range \(0000000100000000 not between 0 and 4294967294\)
|
4
gas/testsuite/gas/s390/zarch-z900-err.s
Normal file
4
gas/testsuite/gas/s390/zarch-z900-err.s
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.text
|
||||||
|
foo:
|
||||||
|
brasl %r6,.-0x100000002
|
||||||
|
brasl %r6,.+0x100000000
|
Reference in New Issue
Block a user