aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorLulu Cai <cailulu@loongson.cn>2023-11-15 19:20:53 +0800
committerliuzhensong <liuzhensong@loongson.cn>2023-11-22 14:39:35 +0800
commitdf4ffdd8c87b32357f929fb4a861760038f3bbb8 (patch)
treefc4873955fd988400c9990bb2e9cd134c7a823c0 /gas
parentf178a375085d796ceeb8c6551b18e34b2653cc88 (diff)
downloadgdb-df4ffdd8c87b32357f929fb4a861760038f3bbb8.zip
gdb-df4ffdd8c87b32357f929fb4a861760038f3bbb8.tar.gz
gdb-df4ffdd8c87b32357f929fb4a861760038f3bbb8.tar.bz2
LoongArch: fix internal error when as handling unsupported modifier.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/loongarch-parse.y6
-rw-r--r--gas/testsuite/gas/loongarch/reloc_type.d3
-rw-r--r--gas/testsuite/gas/loongarch/reloc_type.l2
-rw-r--r--gas/testsuite/gas/loongarch/reloc_type.s3
4 files changed, 13 insertions, 1 deletions
diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y
index f4e1a63..f786fda 100644
--- a/gas/config/loongarch-parse.y
+++ b/gas/config/loongarch-parse.y
@@ -132,7 +132,11 @@ reloc (const char *op_c_str, const char *id_c_str, offsetT addend)
if (0 == strcmp (op_c_str, "plt"))
btype = BFD_RELOC_LARCH_B26;
else
- btype = loongarch_larch_reloc_name_lookup (NULL, op_c_str);
+ {
+ btype = loongarch_larch_reloc_name_lookup (NULL, op_c_str);
+ if (btype == BFD_RELOC_NONE)
+ as_fatal (_("unsupported modifier %s"), op_c_str);
+ }
if (id_c_str)
{
diff --git a/gas/testsuite/gas/loongarch/reloc_type.d b/gas/testsuite/gas/loongarch/reloc_type.d
new file mode 100644
index 0000000..0a8f778
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/reloc_type.d
@@ -0,0 +1,3 @@
+#as:
+#source: reloc_type.s
+#error_output: reloc_type.l
diff --git a/gas/testsuite/gas/loongarch/reloc_type.l b/gas/testsuite/gas/loongarch/reloc_type.l
new file mode 100644
index 0000000..e981f6f
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/reloc_type.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*Fatal error: unsupported modifier (.*)$
diff --git a/gas/testsuite/gas/loongarch/reloc_type.s b/gas/testsuite/gas/loongarch/reloc_type.s
new file mode 100644
index 0000000..2ce2777
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/reloc_type.s
@@ -0,0 +1,3 @@
+.L1:
+ nop
+ addi.d $a0,$a1,%reloc(x)