aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2024-06-04 12:56:22 +0100
committerRichard Earnshaw <rearnsha@arm.com>2024-06-05 17:45:45 +0100
commite8cf93739c9a62daa8371a68af52c736d245f8b9 (patch)
tree884d531ebc188211dbfb31670406a446cdec8ce4 /gas
parentbe9943151aba8d283b81bdc95a8b2ffa5b1d0f1a (diff)
downloadgdb-e8cf93739c9a62daa8371a68af52c736d245f8b9.zip
gdb-e8cf93739c9a62daa8371a68af52c736d245f8b9.tar.gz
gdb-e8cf93739c9a62daa8371a68af52c736d245f8b9.tar.bz2
arm: redirect fp constant data directives through a wrapper
Assembler directives such as .float, or .double are handled by generic code, but on Arm, their output can vary depeding on the type of FPU begin targetted. When we remove FPA support we don't want to silently generate different code for processors that previously defaulted to the FPA, so redirect these directives through a wrapper function that checks the FPU is enabled; we use the legacy -mno-fpu in the test to catch this. Also fix a few tests so that they won't start to fail on targets (eg arm-wince-pe) where there is no default format for the FPU and we pick this from the default processor type.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-arm.c25
-rw-r--r--gas/testsuite/gas/all/gas.exp2
-rw-r--r--gas/testsuite/gas/arm/bfloat16-directive-be.d2
-rw-r--r--gas/testsuite/gas/arm/bfloat16-directive-le.d2
-rw-r--r--gas/testsuite/gas/arm/float16-bad.d1
-rw-r--r--gas/testsuite/gas/arm/float16-be.d2
-rw-r--r--gas/testsuite/gas/arm/float16-format-opt-bad.d2
-rw-r--r--gas/testsuite/gas/arm/float16-le.d2
-rw-r--r--gas/testsuite/gas/arm/fp-directive-bad.d4
-rw-r--r--gas/testsuite/gas/arm/fp-directive-bad.l7
-rw-r--r--gas/testsuite/gas/arm/fp-directive.d9
-rw-r--r--gas/testsuite/gas/arm/fp-directive.s7
12 files changed, 55 insertions, 10 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 9294619..1ba7bb3 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -5148,6 +5148,14 @@ set_fp16_format (int dummy ATTRIBUTE_UNUSED)
ignore_rest_of_line ();
}
+static void s_arm_float_cons (int float_type)
+{
+ /* We still parse the directive on error, so that any syntactic issues
+ are picked up. */
+ if (ARM_FEATURE_ZERO (selected_fpu))
+ as_bad (_("the floating-point format has not been set (or has been disabled)"));
+ float_cons (float_type);
+}
/* This table describes all the machine specific pseudo-ops the assembler
has to support. The fields are:
pseudo-op name without dot
@@ -5212,10 +5220,17 @@ const pseudo_typeS md_pseudo_table[] =
{ "loc", dwarf2_directive_loc, 0 },
{ "loc_mark_labels", dwarf2_directive_loc_mark_labels, 0 },
#endif
- { "extend", float_cons, 'x' },
- { "ldouble", float_cons, 'x' },
- { "packed", float_cons, 'p' },
- { "bfloat16", float_cons, 'b' },
+ /* Override the default float_cons handling so that we can validate
+ the FPU setting. */
+ { "float", s_arm_float_cons, 'f' },
+ { "single", s_arm_float_cons, 'f' },
+ { "double", s_arm_float_cons, 'd' },
+ { "dc.s", s_arm_float_cons, 'f' },
+ { "dc.d", s_arm_float_cons, 'd' },
+ { "extend", s_arm_float_cons, 'x' },
+ { "ldouble", s_arm_float_cons, 'x' },
+ { "packed", s_arm_float_cons, 'p' },
+ { "bfloat16", s_arm_float_cons, 'b' },
#ifdef TE_PE
{"secrel32", pe_directive_secrel, 0},
#endif
@@ -5226,7 +5241,7 @@ const pseudo_typeS md_pseudo_table[] =
{"asmfunc", s_ccs_asmfunc, 0},
{"endasmfunc", s_ccs_endasmfunc, 0},
- {"float16", float_cons, 'h' },
+ {"float16", s_arm_float_cons, 'h' },
{"float16_format", set_fp16_format, 0 },
{ 0, 0, 0 }
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index b9ff439..af461b1 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -47,6 +47,8 @@ if { ![istarget cris-*-*] && ![istarget crisv32-*-*]
&& ![istarget z80-*-*] } then {
if { [istarget tic4x-*-*] } then {
set as_opt ""
+ } elseif { [istarget arm*-*-pe ] } then {
+ set as_opt "--defsym hasnan=1 -mfpu=softvfp"
} else {
set as_opt "--defsym hasnan=1"
}
diff --git a/gas/testsuite/gas/arm/bfloat16-directive-be.d b/gas/testsuite/gas/arm/bfloat16-directive-be.d
index 8862f83..44eadb3 100644
--- a/gas/testsuite/gas/arm/bfloat16-directive-be.d
+++ b/gas/testsuite/gas/arm/bfloat16-directive-be.d
@@ -1,7 +1,7 @@
# name: Big endian bfloat16 literal directives
# source: bfloat16-directive.s
# objdump: -s --section=.data
-# as: -mbig-endian
+# as: -mbig-endian -mfpu=softvfp
.*: +file format .*
diff --git a/gas/testsuite/gas/arm/bfloat16-directive-le.d b/gas/testsuite/gas/arm/bfloat16-directive-le.d
index da94b6b..c595d8b 100644
--- a/gas/testsuite/gas/arm/bfloat16-directive-le.d
+++ b/gas/testsuite/gas/arm/bfloat16-directive-le.d
@@ -1,7 +1,7 @@
# name: Little endian bfloat16 literal directives
# source: bfloat16-directive.s
# objdump: -s --section=.data
-# as: -mlittle-endian
+# as: -mlittle-endian -mfpu=softvfp
.*: +file format .*
diff --git a/gas/testsuite/gas/arm/float16-bad.d b/gas/testsuite/gas/arm/float16-bad.d
index 8eac0af..604bb20 100644
--- a/gas/testsuite/gas/arm/float16-bad.d
+++ b/gas/testsuite/gas/arm/float16-bad.d
@@ -1,3 +1,4 @@
# name: Invalid float16 literals (IEEE 754 & Alternative)
# source: float16-bad.s
# error_output: float16-bad.l
+# as: -mfpu=softvfp
diff --git a/gas/testsuite/gas/arm/float16-be.d b/gas/testsuite/gas/arm/float16-be.d
index e31d9fb..b63d6cd 100644
--- a/gas/testsuite/gas/arm/float16-be.d
+++ b/gas/testsuite/gas/arm/float16-be.d
@@ -1,7 +1,7 @@
# name: Big endian float16 literals (IEEE 754 & Alternative)
# source: float16.s
# objdump: -s --section=.data
-# as: -mbig-endian
+# as: -mbig-endian -mfpu=softvfp
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/float16-format-opt-bad.d b/gas/testsuite/gas/arm/float16-format-opt-bad.d
index 8611258..af8cca4 100644
--- a/gas/testsuite/gas/arm/float16-format-opt-bad.d
+++ b/gas/testsuite/gas/arm/float16-format-opt-bad.d
@@ -1,4 +1,4 @@
# name: Invalid combination of command line arguments and directives
# source: float16.s
# error_output: float16-format-opt-bad.l
-# as: -mfp16-format=ieee
+# as: -mfpu=softvfp -mfp16-format=ieee
diff --git a/gas/testsuite/gas/arm/float16-le.d b/gas/testsuite/gas/arm/float16-le.d
index c1fe7c2..abbf092 100644
--- a/gas/testsuite/gas/arm/float16-le.d
+++ b/gas/testsuite/gas/arm/float16-le.d
@@ -1,7 +1,7 @@
# name: Little endian float16 literals (IEEE 754 & Alternative)
# source: float16.s
# objdump: -s --section=.data
-# as: -mlittle-endian
+# as: -mlittle-endian -mfpu=softvfp
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/fp-directive-bad.d b/gas/testsuite/gas/arm/fp-directive-bad.d
new file mode 100644
index 0000000..dfa01e6
--- /dev/null
+++ b/gas/testsuite/gas/arm/fp-directive-bad.d
@@ -0,0 +1,4 @@
+#name: floating-point directives disabled
+#source: fp-directive.s
+#as: -mno-warn-deprecated -mno-fpu
+#error_output: fp-directive-bad.l \ No newline at end of file
diff --git a/gas/testsuite/gas/arm/fp-directive-bad.l b/gas/testsuite/gas/arm/fp-directive-bad.l
new file mode 100644
index 0000000..263cc9e
--- /dev/null
+++ b/gas/testsuite/gas/arm/fp-directive-bad.l
@@ -0,0 +1,7 @@
+[^:]*: Assembler messages:
+[^:]*:2: Error: the floating-point format has not been set \(or has been disabled\)
+[^:]*:3: Error: the floating-point format has not been set \(or has been disabled\)
+[^:]*:4: Error: the floating-point format has not been set \(or has been disabled\)
+[^:]*:5: Error: the floating-point format has not been set \(or has been disabled\)
+[^:]*:6: Error: the floating-point format has not been set \(or has been disabled\)
+[^:]*:7: Error: the floating-point format has not been set \(or has been disabled\)
diff --git a/gas/testsuite/gas/arm/fp-directive.d b/gas/testsuite/gas/arm/fp-directive.d
new file mode 100644
index 0000000..46ff9e9
--- /dev/null
+++ b/gas/testsuite/gas/arm/fp-directive.d
@@ -0,0 +1,9 @@
+#name: floating-point directives
+#objdump: -s --section=.data
+#as: -mfpu=softvfp
+
+.*: +file format .*arm.*
+
+Contents of section \.data:
+ 0000 .*
+ 0010 .*
diff --git a/gas/testsuite/gas/arm/fp-directive.s b/gas/testsuite/gas/arm/fp-directive.s
new file mode 100644
index 0000000..c6fc227
--- /dev/null
+++ b/gas/testsuite/gas/arm/fp-directive.s
@@ -0,0 +1,7 @@
+ .data
+ .float 1.0
+ .double 2.0
+ .single 3.0
+ .dc.s 5.3
+ .dc.d 6
+ .float16 4.0