gas: Fix checking for backwards .org with negative offset
This patch fixes internal errors in (at least) arm and aarch64 GAS
when assembling code that attempts a negative .org. The bug appears
to be a regression introduced in binutils-2.29 by commit 9875b36538
.
* write.c (relax_segment): Fix handling of negative offset when
relaxing an rs_org frag.
* testsuite/gas/aarch64/org-neg.d: New test.
* testsuite/gas/aarch64/org-neg.l: Error output for test.
* testsuite/gas/aarch64/org-neg.s: Input for test.
* testsuite/gas/arm/org-neg.d: New test.
* testsuite/gas/arm/org-neg.l: Error output for test.
* testsuite/gas/arm/org-neg.s: Input for test.
This commit is contained in:
parent
2fdb65f247
commit
c39c821c1d
@ -1,3 +1,14 @@
|
||||
2020-06-01 Alex Coplan <alex.coplan@arm.com>
|
||||
|
||||
* write.c (relax_segment): Fix handling of negative offset when
|
||||
relaxing an rs_org frag.
|
||||
* testsuite/gas/aarch64/org-neg.d: New test.
|
||||
* testsuite/gas/aarch64/org-neg.l: Error output for test.
|
||||
* testsuite/gas/aarch64/org-neg.s: Input for test.
|
||||
* testsuite/gas/arm/org-neg.d: New test.
|
||||
* testsuite/gas/arm/org-neg.l: Error output for test.
|
||||
* testsuite/gas/arm/org-neg.s: Input for test.
|
||||
|
||||
2020-05-28 Stephen Casner <casner@acm.org>
|
||||
|
||||
Fix unexpected failures in gas testsuite for pdp11-aout target.
|
||||
|
3
gas/testsuite/gas/aarch64/org-neg.d
Normal file
3
gas/testsuite/gas/aarch64/org-neg.d
Normal file
@ -0,0 +1,3 @@
|
||||
#name: negative org should not cause internal error
|
||||
#source: org-neg.s
|
||||
#error_output: org-neg.l
|
2
gas/testsuite/gas/aarch64/org-neg.l
Normal file
2
gas/testsuite/gas/aarch64/org-neg.l
Normal file
@ -0,0 +1,2 @@
|
||||
[^:]*: Assembler messages:
|
||||
.*: Error: attempt to move .org backwards
|
2
gas/testsuite/gas/aarch64/org-neg.s
Normal file
2
gas/testsuite/gas/aarch64/org-neg.s
Normal file
@ -0,0 +1,2 @@
|
||||
.=-1
|
||||
ret
|
3
gas/testsuite/gas/arm/org-neg.d
Normal file
3
gas/testsuite/gas/arm/org-neg.d
Normal file
@ -0,0 +1,3 @@
|
||||
#name: negative org should not cause internal error
|
||||
#source: org-neg.s
|
||||
#error_output: org-neg.l
|
2
gas/testsuite/gas/arm/org-neg.l
Normal file
2
gas/testsuite/gas/arm/org-neg.l
Normal file
@ -0,0 +1,2 @@
|
||||
[^:]*: Assembler messages:
|
||||
.*: Error: attempt to move .org backwards
|
2
gas/testsuite/gas/arm/org-neg.s
Normal file
2
gas/testsuite/gas/arm/org-neg.s
Normal file
@ -0,0 +1,2 @@
|
||||
.=-1
|
||||
nop
|
@ -2940,7 +2940,7 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass)
|
||||
|
||||
case rs_org:
|
||||
{
|
||||
addressT target = offset;
|
||||
offsetT target = offset;
|
||||
addressT after;
|
||||
|
||||
if (symbolP)
|
||||
@ -2960,7 +2960,7 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass)
|
||||
/* Growth may be negative, but variable part of frag
|
||||
cannot have fewer than 0 chars. That is, we can't
|
||||
.org backwards. */
|
||||
if (address + fragP->fr_fix > target)
|
||||
if ((offsetT) (address + fragP->fr_fix) > target)
|
||||
{
|
||||
growth = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user