gas/
authorJulian Brown <julian@codesourcery.com>
Mon, 15 Apr 2013 10:30:23 +0000 (10:30 +0000)
committerJulian Brown <julian@codesourcery.com>
Mon, 15 Apr 2013 10:30:23 +0000 (10:30 +0000)
    * 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.

16 files changed:
gas/ChangeLog
gas/config/tc-sh.c
gas/expr.c
gas/expr.h
gas/testsuite/ChangeLog
gas/testsuite/gas/all/gas.exp
gas/testsuite/gas/all/sleb128-2.d
gas/testsuite/gas/all/sleb128-2.s
gas/testsuite/gas/all/sleb128-3.d
gas/testsuite/gas/all/sleb128-3.s
gas/testsuite/gas/all/sleb128-4.d
gas/testsuite/gas/all/sleb128-4.s
gas/testsuite/gas/all/sleb128-5.d
gas/testsuite/gas/all/sleb128-5.s
gas/testsuite/gas/all/sleb128-7.d
gas/testsuite/gas/all/sleb128-7.s

index ca37956272cd1f211cddd9c864503fe7b4ca8897..6d3c152ba162273c89cfa38c21f4df52db091720 100644 (file)
@@ -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
index 4db1a0913602aaf18d1390cc315f6db0fbdef649..6b7bd5a35946985c9772f600a8ac34cfd1aaaec7 100644 (file)
@@ -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;
index 64011b497de2cea263b2355b868f0651799591ab..c4b2b756bae5b94b4266bd8c0e405f63ca5fb2b0 100644 (file)
@@ -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;
index d2cb7fd50fffe6a7cc26b2325bdaf7733c0a27b8..438ac0dcc138ee95ce0188903df37c9ac6ccbbeb 100644 (file)
@@ -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);
index 5db53c8bc8e38559b8a18164386f88c660f89269..546c2ab14aefaad5f40bace31c0a223d83e30f66 100644 (file)
@@ -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.
index c85d918ee3ff897fa24f76b2bd79e2210ea28b4b..709b448701e470431aba12ae9efdd5510aa92af7 100644 (file)
@@ -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.
index f3d052d4ecaaad6a09de2b4d05afb3ec6764d16d..cce0b4c0334a83b7c67a30e05ca94af83736c25c 100644 (file)
@@ -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.*
index 49c52af1ffafd600a6061df8213cab8168e09cc8..94f7afefba40e13adc2b71c2736e8a5ac934c7df 100644 (file)
@@ -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
index ffb3a26e8edbfbca492fa68a16fee4606e5cdeb6..deb48a69a498b41afe141c496489245ead881743 100644 (file)
@@ -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.*
index 8aa80268cffa0441a004a7252036f9701162441b..66d0a2570a927c9f2a8f7ba9bd508640c0783665 100644 (file)
@@ -1,4 +1,3 @@
-.data
-bar:
-.sleb128 100 - 200
-.byte 42
+       .data
+       .sleb128 100 - 200
+       .byte 42
index 80c99ab4354a5d8cf689f86fe3891ee272aed4b0..0c56696d8e11e06285fea7ae1a6c3eee7a6cb89b 100644 (file)
@@ -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.*
index a2d9d82d1bf082aece49d187a2544f6a0d1c6985..1bc561f69725e9336fa6e4632f91accf55320435 100644 (file)
@@ -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
index 1e3924246ad79e2b4901ca9fcc2a7d35d9bb3f96..0accfb5a6e8860866acd6bd34e57c725374724a2 100644 (file)
@@ -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.*
index 64e5793823b594517ebff283e2afc3c6f0315fa2..b31725efeaffcd0487da7b9186db21bb0d670043 100644 (file)
@@ -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
index 805ee4db75aac3684dc5e68b1f3405a880309d14..6fcbdefe6e939902fae24509730217eeaab7cf7c 100644 (file)
@@ -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.*
index 323689bc9a30845c806810a92d074e3c8660dcad..090217fd697adba27a9595c11244e1661fd901ec 100644 (file)
@@ -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
This page took 0.042041 seconds and 4 git commands to generate.