diff options
author | Julian Brown <julian@codesourcery.com> | 2013-04-15 10:30:23 +0000 |
---|---|---|
committer | Julian Brown <julian@codesourcery.com> | 2013-04-15 10:30:23 +0000 |
commit | 4455e9adedb85db6c3125a546f85ad70fef1c25d (patch) | |
tree | 7e65221747923c13540a88ca73def0d9311a1f6e /gas | |
parent | ceb0a680b14c984392861edbe0c023f3aee7fc7d (diff) | |
download | binutils-4455e9adedb85db6c3125a546f85ad70fef1c25d.zip binutils-4455e9adedb85db6c3125a546f85ad70fef1c25d.tar.gz binutils-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')
-rw-r--r-- | gas/ChangeLog | 8 | ||||
-rw-r--r-- | gas/config/tc-sh.c | 9 | ||||
-rw-r--r-- | gas/expr.c | 4 | ||||
-rw-r--r-- | gas/expr.h | 2 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/all/gas.exp | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-2.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-2.s | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-3.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-3.s | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-4.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-4.s | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-5.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-5.s | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-7.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/all/sleb128-7.s | 33 |
16 files changed, 91 insertions, 75 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index ca37956..6d3c152 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2013-04-15 Julian Brown <julian@codesourcery.com> + + * 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. + 2013-04-10 Julian Brown <julian@codesourcery.com> * read.c (convert_to_bignum): Add sign parameter. Use it 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; @@ -1729,7 +1729,7 @@ operatorf (int *num_chars) signed word values can be represented in an O_constant expression, which is useful e.g. for .sleb128 directives. */ -static void +void add_to_result (expressionS *resultP, offsetT amount, int rhs_highbit) { valueT ures = resultP->X_add_number; @@ -1745,7 +1745,7 @@ add_to_result (expressionS *resultP, offsetT amount, int rhs_highbit) /* Similarly, for subtraction. */ -static void +void subtract_from_result (expressionS *resultP, offsetT amount, int rhs_highbit) { valueT ures = resultP->X_add_number; @@ -175,6 +175,8 @@ extern char get_symbol_end (void); extern void expr_begin (void); extern void expr_set_precedence (void); extern void expr_set_rank (operatorT, operator_rankT); +extern void add_to_result (expressionS *, offsetT, int); +extern void subtract_from_result (expressionS *, offsetT, int); extern segT expr (int, expressionS *, enum expr_mode); extern unsigned int get_single_number (void); extern symbolS *make_expr_symbol (expressionS * expressionP); diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 5db53c8..546c2ab 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2013-04-15 Julian Brown <julian@codesourcery.com> + + * 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. + 2013-04-10 Julian Brown <julian@codesourcery.com> * gas/all/sleb128-2.s: New test. diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp index c85d918..709b448 100644 --- a/gas/testsuite/gas/all/gas.exp +++ b/gas/testsuite/gas/all/gas.exp @@ -373,7 +373,10 @@ run_dump_test sleb128-2 run_dump_test sleb128-3 run_dump_test sleb128-4 run_dump_test sleb128-5 -run_dump_test sleb128-7 +# .byte is not 8 bits on either tic4x or tic54x +if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } { + run_dump_test sleb128-7 +} # .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x # .space is different on hppa*-hpux. diff --git a/gas/testsuite/gas/all/sleb128-2.d b/gas/testsuite/gas/all/sleb128-2.d index f3d052d..cce0b4c 100644 --- a/gas/testsuite/gas/all/sleb128-2.d +++ b/gas/testsuite/gas/all/sleb128-2.d @@ -1,7 +1,7 @@ -#objdump : -s -j .data +#objdump : -s -j .data -j "\$DATA\$" #name : .sleb128 tests (2) .*: .* -Contents of section \.data: +Contents of section (\.data|\$DATA\$): .* 7d2a.* diff --git a/gas/testsuite/gas/all/sleb128-2.s b/gas/testsuite/gas/all/sleb128-2.s index 49c52af..94f7afe 100644 --- a/gas/testsuite/gas/all/sleb128-2.s +++ b/gas/testsuite/gas/all/sleb128-2.s @@ -1,13 +1,10 @@ -.text -.globl foo -foo: -.L1: -.byte 0 -.byte 0 -.byte 0 -.L2: + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: -.data -bar: -.sleb128 .L1 - .L2 -.byte 42 + .data + .sleb128 _L1 - _L2 + .byte 42 diff --git a/gas/testsuite/gas/all/sleb128-3.d b/gas/testsuite/gas/all/sleb128-3.d index ffb3a26..deb48a6 100644 --- a/gas/testsuite/gas/all/sleb128-3.d +++ b/gas/testsuite/gas/all/sleb128-3.d @@ -1,7 +1,7 @@ -#objdump : -s -j .data +#objdump : -s -j .data -j "\$DATA\$" #name : .sleb128 tests (3) .*: .* -Contents of section \.data: +Contents of section (\.data|\$DATA\$): .* 9c7f2a.* diff --git a/gas/testsuite/gas/all/sleb128-3.s b/gas/testsuite/gas/all/sleb128-3.s index 8aa8026..66d0a25 100644 --- a/gas/testsuite/gas/all/sleb128-3.s +++ b/gas/testsuite/gas/all/sleb128-3.s @@ -1,4 +1,3 @@ -.data -bar: -.sleb128 100 - 200 -.byte 42 + .data + .sleb128 100 - 200 + .byte 42 diff --git a/gas/testsuite/gas/all/sleb128-4.d b/gas/testsuite/gas/all/sleb128-4.d index 80c99ab..0c56696 100644 --- a/gas/testsuite/gas/all/sleb128-4.d +++ b/gas/testsuite/gas/all/sleb128-4.d @@ -1,7 +1,7 @@ -#objdump : -s -j .data +#objdump : -s -j .data -j "\$DATA\$" #name : .sleb128 tests (4) .*: .* -Contents of section \.data: +Contents of section (\.data|\$DATA\$): .* 83808080 082a.* diff --git a/gas/testsuite/gas/all/sleb128-4.s b/gas/testsuite/gas/all/sleb128-4.s index a2d9d82..1bc561f 100644 --- a/gas/testsuite/gas/all/sleb128-4.s +++ b/gas/testsuite/gas/all/sleb128-4.s @@ -1,13 +1,10 @@ -.text -.globl foo -foo: -.L1: -.byte 0 -.byte 0 -.byte 0 -.L2: + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: -.data -bar: -.sleb128 .L2 - .L1 + (1 << 31) -.byte 42 + .data + .sleb128 _L2 - _L1 + (1 << 31) + .byte 42 diff --git a/gas/testsuite/gas/all/sleb128-5.d b/gas/testsuite/gas/all/sleb128-5.d index 1e39242..0accfb5 100644 --- a/gas/testsuite/gas/all/sleb128-5.d +++ b/gas/testsuite/gas/all/sleb128-5.d @@ -1,7 +1,7 @@ -#objdump : -s -j .data +#objdump : -s -j .data -j "\$DATA\$" #name : .sleb128 tests (5) .*: .* -Contents of section \.data: +Contents of section (\.data|\$DATA\$): .* 012a.* diff --git a/gas/testsuite/gas/all/sleb128-5.s b/gas/testsuite/gas/all/sleb128-5.s index 64e5793..b31725e 100644 --- a/gas/testsuite/gas/all/sleb128-5.s +++ b/gas/testsuite/gas/all/sleb128-5.s @@ -1,13 +1,10 @@ -.text -.globl foo -foo: -.L1: -.byte 0 -.byte 0 -.byte 0 -.L2: + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: -.data -bar: -.sleb128 .L1 - .L2 + 4 -.byte 42 + .data + .sleb128 _L1 - _L2 + 4 + .byte 42 diff --git a/gas/testsuite/gas/all/sleb128-7.d b/gas/testsuite/gas/all/sleb128-7.d index 805ee4d..6fcbdef 100644 --- a/gas/testsuite/gas/all/sleb128-7.d +++ b/gas/testsuite/gas/all/sleb128-7.d @@ -1,7 +1,7 @@ -#objdump : -s -j .data +#objdump : -s -j .data -j "\$DATA\$" #name : .sleb128 tests (7) .*: .* -Contents of section \.data: +Contents of section (\.data|\$DATA\$): .* cb012ac5 012acb01 2ac5012a.* diff --git a/gas/testsuite/gas/all/sleb128-7.s b/gas/testsuite/gas/all/sleb128-7.s index 323689b..090217f 100644 --- a/gas/testsuite/gas/all/sleb128-7.s +++ b/gas/testsuite/gas/all/sleb128-7.s @@ -1,19 +1,16 @@ -.text -.globl foo -foo: -.L1: -.byte 0 -.byte 0 -.byte 0 -.L2: + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: -.data -bar: -.sleb128 200+(.L2 - .L1) -.byte 42 -.sleb128 200+(.L1 - .L2) -.byte 42 -.sleb128 (.L2 - .L1)+200 -.byte 42 -.sleb128 (.L1 - .L2)+200 -.byte 42 + .data + .sleb128 200+(_L2 - _L1) + .byte 42 + .sleb128 200+(_L1 - _L2) + .byte 42 + .sleb128 (_L2 - _L1)+200 + .byte 42 + .sleb128 (_L1 - _L2)+200 + .byte 42 |