diff options
author | Alex Coplan <alex.coplan@arm.com> | 2020-05-29 16:04:50 +0100 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-06-02 00:10:40 +0930 |
commit | c39c821c1da3e8a64eff5984a39e104eb798e8b8 (patch) | |
tree | e624f399a22271c5a1ff6d681387468e31f31c16 /gas/write.c | |
parent | 2fdb65f247379befd548a33ea185172968b9ebb9 (diff) | |
download | gdb-c39c821c1da3e8a64eff5984a39e104eb798e8b8.zip gdb-c39c821c1da3e8a64eff5984a39e104eb798e8b8.tar.gz gdb-c39c821c1da3e8a64eff5984a39e104eb798e8b8.tar.bz2 |
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 9875b36538d.
* 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.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gas/write.c b/gas/write.c index 5825117..9a50185 100644 --- a/gas/write.c +++ b/gas/write.c @@ -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; |