aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2019-10-07 16:34:31 +0100
committerNick Clifton <nickc@redhat.com>2019-10-07 16:34:31 +0100
commitc0ea7c52e10024ecd29b8f0e23b666b6af926c6e (patch)
tree6be0be49c09e42f501772b4575576057ac57bc33 /gas/testsuite
parent93370e8e7b406cf0aeedcf57cf457c07d6a2c7e6 (diff)
downloadgdb-c0ea7c52e10024ecd29b8f0e23b666b6af926c6e.zip
gdb-c0ea7c52e10024ecd29b8f0e23b666b6af926c6e.tar.gz
gdb-c0ea7c52e10024ecd29b8f0e23b666b6af926c6e.tar.bz2
Add support for new functionality in the msp430 backend of GCC.
This functionality will generate a new GNU object attribute for the "data region" has been added. This object attribute is used mark whether the compiler has generated code assuming that data could be in the upper or lower memory regions. Code which assumes data is always in the lower memory region is incompatible with code which uses the full memory range for data. The patch also adds a new assembler directive ".mspabi_attribute" to handle the existing MSPABI object attributes. GCC will now emit both .gnu_attribute and .mspabi_attribute directives to indicate what options the source file was compiled with. The assembler will now check the values set in these directives against the options that the it has been invoked with. If there is a discrepancy, the assembler will exit with an error. bfd * elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to.. (elf32_msp430_merge_msp430_attributes): Add support for merging the GNU object attribute for data region. binutils* readelf.c (display_msp430_gnu_attribute): New. (process_arch_specific): Use msp430 specific handler for GNU attributes. gas * config/tc-msp430.c (md_parse_option): Set lower_data_region_only to FALSE if the data region is set to "upper", "either" or "none". (msp430_object_attribute): New. (md_pseudo_table): Handle .mspabi_attribute and .gnu_attribute. (msp430_md_end): Replace hard-coded attribute values with enums. Handle data region object attribute. * doc/as.texi: Document MSP430 Data Region object attribute. * doc/c-msp430.texi: Document the .mspabi_attribute directive. * testsuite/gas/msp430/attr-430-small-bad.d: New test. * testsuite/gas/msp430/attr-430-small-bad.l: New test. * testsuite/gas/msp430/attr-430-small-good.d: New test. * testsuite/gas/msp430/attr-430-small.s: New test. * testsuite/gas/msp430/attr-430x-large-any-bad.d: New test. * testsuite/gas/msp430/attr-430x-large-any-bad.l: New test. * testsuite/gas/msp430/attr-430x-large-any-good.d: New test. * testsuite/gas/msp430/attr-430x-large-any.s: New test. * testsuite/gas/msp430/attr-430x-large-lower-bad.d: New test. * testsuite/gas/msp430/attr-430x-large-lower-bad.l: New test. * testsuite/gas/msp430/attr-430x-large-lower-good.d: New test. * testsuite/gas/msp430/attr-430x-large-lower.s: New test. * testsuite/gas/msp430/msp430.exp: Run new tests. include * elf/msp430.h: Add enums for MSPABI and GNU object attribute tag names and values. ld * testsuite/ld-msp430-elf/attr-gnu-main.s: New test. * testsuite/ld-msp430-elf/attr-gnu-obj.s: New test. * testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test. * testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test. * testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test. * testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/msp430/attr-430-small-bad.d4
-rw-r--r--gas/testsuite/gas/msp430/attr-430-small-bad.l4
-rw-r--r--gas/testsuite/gas/msp430/attr-430-small-good.d6
-rw-r--r--gas/testsuite/gas/msp430/attr-430-small.s3
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-any-bad.d4
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-any-bad.l3
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-any-good.d6
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-any.s4
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-lower-bad.d4
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-lower-bad.l3
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-lower-good.d6
-rw-r--r--gas/testsuite/gas/msp430/attr-430x-large-lower.s4
-rw-r--r--gas/testsuite/gas/msp430/msp430.exp6
13 files changed, 57 insertions, 0 deletions
diff --git a/gas/testsuite/gas/msp430/attr-430-small-bad.d b/gas/testsuite/gas/msp430/attr-430-small-bad.d
new file mode 100644
index 0000000..302ba57
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430-small-bad.d
@@ -0,0 +1,4 @@
+#name: Error when 430 ISA and small memory model object attributes conflict with options
+#source: attr-430-small.s
+#as: -mdata-region=none -ml
+#error_output: attr-430-small-bad.l
diff --git a/gas/testsuite/gas/msp430/attr-430-small-bad.l b/gas/testsuite/gas/msp430/attr-430-small-bad.l
new file mode 100644
index 0000000..c339ecf
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430-small-bad.l
@@ -0,0 +1,4 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: file was compiled for the 430 ISA but the 430X ISA is selected
+[^:]*:2: Error: file was compiled for the small memory model, but the large memory model is selected
+[^:]*:3: Error: file was compiled for the small memory model, but the large memory model is selected
diff --git a/gas/testsuite/gas/msp430/attr-430-small-good.d b/gas/testsuite/gas/msp430/attr-430-small-good.d
new file mode 100644
index 0000000..5f3137f
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430-small-good.d
@@ -0,0 +1,6 @@
+#name: 430 ISA and small memory model object attributes
+#source: attr-430-small.s
+#as: -mcpu=msp430
+#objdump: -t
+
+#pass
diff --git a/gas/testsuite/gas/msp430/attr-430-small.s b/gas/testsuite/gas/msp430/attr-430-small.s
new file mode 100644
index 0000000..2bdb1db
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430-small.s
@@ -0,0 +1,3 @@
+.mspabi_attribute 4, 1 ; OFBA_MSPABI_Tag_ISA == 430
+.mspabi_attribute 6, 1 ; OFBA_MSPABI_Tag_Code_Model == Small
+.mspabi_attribute 8, 1 ; OFBA_MSPABI_Tag_Data_Model == Small
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-any-bad.d b/gas/testsuite/gas/msp430/attr-430x-large-any-bad.d
new file mode 100644
index 0000000..6793f7c
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-any-bad.d
@@ -0,0 +1,4 @@
+#name: Error when 430X ISA, large memory model and any data region object attributes conflict with options
+#source: attr-430x-large-any.s
+#as: -mcpu=msp430 -ml
+#error_output: attr-430x-large-any-bad.l
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-any-bad.l b/gas/testsuite/gas/msp430/attr-430x-large-any-bad.l
new file mode 100644
index 0000000..c7f2282
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-any-bad.l
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: file was compiled for the 430X ISA but the 430 ISA is selected
+[^:]*:4: Error: file was compiled assuming data could be in the upper memory region, but the lower data region is exclusively in use
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-any-good.d b/gas/testsuite/gas/msp430/attr-430x-large-any-good.d
new file mode 100644
index 0000000..603aab1
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-any-good.d
@@ -0,0 +1,6 @@
+#name: 430X ISA, large memory model and any data region object attributes
+#source: attr-430x-large-any.s
+#as: -ml -mdata-region=none
+#objdump: -t
+
+#pass
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-any.s b/gas/testsuite/gas/msp430/attr-430x-large-any.s
new file mode 100644
index 0000000..593c171
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-any.s
@@ -0,0 +1,4 @@
+.mspabi_attribute 4, 2 ; OFBA_MSPABI_Tag_ISA == 430x
+.mspabi_attribute 6, 2 ; OFBA_MSPABI_Tag_Code_Model == Large
+.mspabi_attribute 8, 2 ; OFBA_MSPABI_Tag_Data_Model == Large
+.gnu_attribute 4, 2 ; Tag_GNU_MSP430_Data_Region == Any
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-lower-bad.d b/gas/testsuite/gas/msp430/attr-430x-large-lower-bad.d
new file mode 100644
index 0000000..fb7e5ca
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-lower-bad.d
@@ -0,0 +1,4 @@
+#name: Error when 430X ISA, large memory model and lower data region object attributes conflict with options
+#source: attr-430x-large-lower.s
+#as: -mdata-region=none -mcpu=msp430 -ml
+#error_output: attr-430x-large-lower-bad.l
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-lower-bad.l b/gas/testsuite/gas/msp430/attr-430x-large-lower-bad.l
new file mode 100644
index 0000000..a21b640
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-lower-bad.l
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: file was compiled for the 430X ISA but the 430 ISA is selected
+[^:]*:4: Error: file was compiled assuming all data will be in the lower memory region, but the upper region is in use
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-lower-good.d b/gas/testsuite/gas/msp430/attr-430x-large-lower-good.d
new file mode 100644
index 0000000..c4a395c
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-lower-good.d
@@ -0,0 +1,6 @@
+#name: 430X ISA, large memory model and lower data region object attributes
+#source: attr-430x-large-lower.s
+#as: -ml
+#objdump: -t
+
+#pass
diff --git a/gas/testsuite/gas/msp430/attr-430x-large-lower.s b/gas/testsuite/gas/msp430/attr-430x-large-lower.s
new file mode 100644
index 0000000..4ab0b5d
--- /dev/null
+++ b/gas/testsuite/gas/msp430/attr-430x-large-lower.s
@@ -0,0 +1,4 @@
+.mspabi_attribute 4, 2 ; OFBA_MSPABI_Tag_ISA == 430x
+.mspabi_attribute 6, 2 ; OFBA_MSPABI_Tag_Code_Model == Large
+.mspabi_attribute 8, 2 ; OFBA_MSPABI_Tag_Data_Model == Large
+.gnu_attribute 4, 1 ; Tag_GNU_MSP430_Data_Region == Lower
diff --git a/gas/testsuite/gas/msp430/msp430.exp b/gas/testsuite/gas/msp430/msp430.exp
index 9c7a197..ef3164d 100644
--- a/gas/testsuite/gas/msp430/msp430.exp
+++ b/gas/testsuite/gas/msp430/msp430.exp
@@ -46,4 +46,10 @@ if [expr [istarget "msp430-*-*"]] then {
run_dump_test "preinit-array"
run_dump_test "init-array"
run_dump_test "fini-array"
+ run_dump_test "attr-430-small-bad"
+ run_dump_test "attr-430-small-good"
+ run_dump_test "attr-430x-large-lower-bad"
+ run_dump_test "attr-430x-large-lower-good"
+ run_dump_test "attr-430x-large-any-bad"
+ run_dump_test "attr-430x-large-any-good"
}