aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-sh.c
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2013-04-15 10:30:23 +0000
committerJulian Brown <julian@codesourcery.com>2013-04-15 10:30:23 +0000
commit4455e9adedb85db6c3125a546f85ad70fef1c25d (patch)
tree7e65221747923c13540a88ca73def0d9311a1f6e /gas/config/tc-sh.c
parentceb0a680b14c984392861edbe0c023f3aee7fc7d (diff)
downloadgdb-4455e9adedb85db6c3125a546f85ad70fef1c25d.zip
gdb-4455e9adedb85db6c3125a546f85ad70fef1c25d.tar.gz
gdb-4455e9adedb85db6c3125a546f85ad70fef1c25d.tar.bz2
gas/
* expr.c (add_to_result, subtract_from_result): Make global. * expr.h (add_to_result, subtract_from_result): Add prototypes. * config/tc-sh.c (sh_optimize_expr): Use add_to_result, subtract_from_result to handle extra bit of precision for .sleb128 directive operands. gas/testsuite/ * gas/all/gas.exp (sleb128-7): Don't run for tic4x, tic54x. * gas/all/sleb128-2.s: Reformat, use _ at start of labels, remove cruft. * gas/all/sleb128-3.s: Likewise. * gas/all/sleb128-4.s: Likewise. * gas/all/sleb128-5.s: Likewise. * gas/all/sleb128-7.s: Likewise. * gas/all/sleb128-2.d: Handle data sections named $DATA$. * gas/all/sleb128-3.d: Likewise. * gas/all/sleb128-4.d: Likewise. * gas/all/sleb128-5.d: Likewise. * gas/all/sleb128-7.d: Likewise.
Diffstat (limited to 'gas/config/tc-sh.c')
-rw-r--r--gas/config/tc-sh.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 4db1a09..6b7bd5a 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -931,10 +931,11 @@ sh_optimize_expr (expressionS *l, operatorT op, expressionS *r)
symbol_get_frag (r->X_add_symbol),
&frag_off))
{
- l->X_add_number -= r->X_add_number;
- l->X_add_number -= frag_off / OCTETS_PER_BYTE;
- l->X_add_number += (S_GET_VALUE (l->X_add_symbol)
- - S_GET_VALUE (r->X_add_symbol));
+ offsetT symval_diff = S_GET_VALUE (l->X_add_symbol)
+ - S_GET_VALUE (r->X_add_symbol);
+ subtract_from_result (l, r->X_add_number, r->X_extrabit);
+ subtract_from_result (l, frag_off / OCTETS_PER_BYTE, 0);
+ add_to_result (l, symval_diff, symval_diff < 0);
l->X_op = O_constant;
l->X_add_symbol = 0;
return 1;