aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-03-16 11:33:55 +0000
committerNick Clifton <nickc@redhat.com>2016-03-16 11:33:55 +0000
commit5f2b6bc955535ebfc280a04c22c937cfedb83916 (patch)
tree1e3ab4d035b80a0ea3f91f113d4bf7ce070e00e2 /gas/testsuite
parent9bff188f0da2859bd5efa8d0def8c0f93d0be410 (diff)
downloadgdb-5f2b6bc955535ebfc280a04c22c937cfedb83916.zip
gdb-5f2b6bc955535ebfc280a04c22c937cfedb83916.tar.gz
gdb-5f2b6bc955535ebfc280a04c22c937cfedb83916.tar.bz2
Fix checking bignum values that are being inserted into byte sized containers.
* read.c (emit_expr_with_reloc): Add code check a bignum with nbytes == 1. * config/rx/rx-parse.y (rx_intop): Accept bignum values for sizes other than 32-bits. * testsuite/gas/elf/bignum.s: New test source file. * testsuite/gas/elf/bignum.d: New test driver file. * testsuite/gas/elf/elf.exp: Run the new test.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/elf/bignums.d14
-rw-r--r--gas/testsuite/gas/elf/bignums.s23
-rw-r--r--gas/testsuite/gas/elf/elf.exp9
3 files changed, 42 insertions, 4 deletions
diff --git a/gas/testsuite/gas/elf/bignums.d b/gas/testsuite/gas/elf/bignums.d
new file mode 100644
index 0000000..799ef3c
--- /dev/null
+++ b/gas/testsuite/gas/elf/bignums.d
@@ -0,0 +1,14 @@
+#readelf: -x .data
+#name: bignum byte values
+#not-target: rx-*
+# The RX target sometimes calls its data section D_1.
+#
+# Test that 8-bit and 16-bit constants can be specified via bignums.
+#
+# Note - we should really apply this test to all targets, not just
+# ELF based ones, but we need a tool that can dump the data section
+# in a fixed format and readelf fits the bill.
+
+Hex dump of section .*:
+ 0x00000000 9800(7698|9876) 9800(7698|9876) 9800.*
+#pass
diff --git a/gas/testsuite/gas/elf/bignums.s b/gas/testsuite/gas/elf/bignums.s
new file mode 100644
index 0000000..91de585
--- /dev/null
+++ b/gas/testsuite/gas/elf/bignums.s
@@ -0,0 +1,23 @@
+ .data
+
+ # On a 64-bit host the two values below will be read into a simple
+ # 64-bit field in the expressionS structure and the type will be set
+ # to O_constant. On a 32-bit host however they will read into the
+ # generic_bignum array and the type set to O_bignum. Either way they
+ # should both evaluate without errors.
+ #
+ # Note - some targets place .hword values on a 16-bit boundary, so we
+ # declare a second, zero, .byte value in order to make the data
+ # consistent across all targets.
+
+ .byte 0xffffffffffffff98, 0
+ .hword 0xffffffffffff9876
+
+ # Check that on 64-bit hosts real bignum values also work.
+
+ .byte 0xffffffffffffffffffffffffffffff98, 0
+ .hword 0xffffffffffffffffffffffffffff9876
+
+ # Also check a ridiculously long bignum value.
+
+ .byte 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff98, 0
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index fb5619d..bde875b 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -226,9 +226,10 @@ if { [is_elf_format] } then {
run_dump_test "strtab"
-load_lib gas-dg.exp
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
-dg-finish
+ run_dump_test "bignums"
+ load_lib gas-dg.exp
+ dg-init
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
+ dg-finish
}