mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
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.
This commit is contained in:
parent
ceb0a680b1
commit
4455e9aded
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.*
|
||||
|
@ -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
|
||||
|
@ -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.*
|
||||
|
@ -1,4 +1,3 @@
|
||||
.data
|
||||
bar:
|
||||
.sleb128 100 - 200
|
||||
.byte 42
|
||||
.data
|
||||
.sleb128 100 - 200
|
||||
.byte 42
|
||||
|
@ -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.*
|
||||
|
@ -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
|
||||
|
@ -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.*
|
||||
|
@ -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
|
||||
|
@ -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.*
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user