aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-04-09 21:23:40 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-04-09 21:23:40 +0100
commit668c5ebc0937ab5288d831d65de3057e56e2763f (patch)
tree8e254249c8aae86d8d3f4eae4789167a1b45c893 /gas
parent2e88a1ea30deecac47d89b03f6d60ca04245c36f (diff)
downloadgdb-668c5ebc0937ab5288d831d65de3057e56e2763f.zip
gdb-668c5ebc0937ab5288d831d65de3057e56e2763f.tar.gz
gdb-668c5ebc0937ab5288d831d65de3057e56e2763f.tar.bz2
MIPS/GAS: Disallow `.option picX' with VxWorks PIC
gas/ * config/tc-mips.c (s_option): Reject `.option picX' if VxWorks PIC. * testsuite/gas/mips/option-pic-vxworks-1.l: New list test. * testsuite/gas/mips/option-pic-vxworks-2.l: New list test. * testsuite/gas/mips/option-pic-vxworks-1.s: New test source. * testsuite/gas/mips/option-pic-vxworks-2.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-mips.c8
-rw-r--r--gas/testsuite/gas/mips/mips.exp10
-rw-r--r--gas/testsuite/gas/mips/option-pic-vxworks-1.l3
-rw-r--r--gas/testsuite/gas/mips/option-pic-vxworks-1.s2
-rw-r--r--gas/testsuite/gas/mips/option-pic-vxworks-2.l3
-rw-r--r--gas/testsuite/gas/mips/option-pic-vxworks-2.s2
7 files changed, 35 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ee54c5c..da02325 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,15 @@
2016-04-09 Maciej W. Rozycki <macro@imgtec.com>
+ * config/tc-mips.c (s_option): Reject `.option picX' if VxWorks
+ PIC.
+ * testsuite/gas/mips/option-pic-vxworks-1.l: New list test.
+ * testsuite/gas/mips/option-pic-vxworks-2.l: New list test.
+ * testsuite/gas/mips/option-pic-vxworks-1.s: New test source.
+ * testsuite/gas/mips/option-pic-vxworks-2.s: New test source.
+ * testsuite/gas/mips/mips.exp: Run the new tests.
+
+2016-04-09 Maciej W. Rozycki <macro@imgtec.com>
+
* config/tc-mips.c (can_swap_branch_p): Correct call formatting.
2016-04-09 Maciej W. Rozycki <macro@imgtec.com>
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index dff78ac..7017444 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -15477,15 +15477,17 @@ s_option (int x ATTRIBUTE_UNUSED)
int i;
i = atoi (opt + 3);
- if (i == 0)
+ if (i != 0 && i != 2)
+ as_bad (_(".option pic%d not supported"), i);
+ else if (mips_pic == VXWORKS_PIC)
+ as_bad (_(".option pic%d not supported in VxWorks PIC mode"), i);
+ else if (i == 0)
mips_pic = NO_PIC;
else if (i == 2)
{
mips_pic = SVR4_PIC;
mips_abicalls = TRUE;
}
- else
- as_bad (_(".option pic%d not supported"), i);
if (mips_pic == SVR4_PIC)
{
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index d30b3b5..02f76cc 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -513,6 +513,11 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "vxworks1-xgot"
run_dump_test "vxworks1-el"
run_dump_test "vxworks1-xgot-el"
+
+ run_list_test "option-pic-vxworks-1" "-mvxworks-pic" \
+ "MIPS invalid PIC option in VxWorks PIC"
+ run_list_test "option-pic-vxworks-2" "-mvxworks-pic" \
+ "MIPS invalid switch to SVR4 PIC from VxWorks PIC"
} elseif { [istarget mips*-*-*] } {
set addr32 [expr [istarget mipstx39*-*-*] || [istarget mips-*-linux*] || [istarget mipsel-*-linux*] \
|| [istarget mipsisa32-*-linux*] || [istarget mipsisa32el-*-linux*]]
@@ -1469,6 +1474,11 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "li-d"
+ run_list_test "option-pic-vxworks-1" "-mvxworks-pic" \
+ "MIPS invalid PIC option in VxWorks PIC"
+ run_list_test "option-pic-vxworks-2" "-mvxworks-pic" \
+ "MIPS invalid switch to SVR4 PIC from VxWorks PIC"
+
run_dump_test_arches "r6" [mips_arch_list_matching mips32r6]
if $has_newabi {
run_dump_test_arches "r6-n32" [mips_arch_list_matching mips64r6]
diff --git a/gas/testsuite/gas/mips/option-pic-vxworks-1.l b/gas/testsuite/gas/mips/option-pic-vxworks-1.l
new file mode 100644
index 0000000..c88f7c0
--- /dev/null
+++ b/gas/testsuite/gas/mips/option-pic-vxworks-1.l
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*:1: Error: \.option pic1 not supported
+.*:2: Error: \.option pic3 not supported
diff --git a/gas/testsuite/gas/mips/option-pic-vxworks-1.s b/gas/testsuite/gas/mips/option-pic-vxworks-1.s
new file mode 100644
index 0000000..62530cc
--- /dev/null
+++ b/gas/testsuite/gas/mips/option-pic-vxworks-1.s
@@ -0,0 +1,2 @@
+ .option pic1
+ .option pic3
diff --git a/gas/testsuite/gas/mips/option-pic-vxworks-2.l b/gas/testsuite/gas/mips/option-pic-vxworks-2.l
new file mode 100644
index 0000000..8c18b1b
--- /dev/null
+++ b/gas/testsuite/gas/mips/option-pic-vxworks-2.l
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*:1: Error: \.option pic0 not supported in VxWorks PIC mode
+.*:2: Error: \.option pic2 not supported in VxWorks PIC mode
diff --git a/gas/testsuite/gas/mips/option-pic-vxworks-2.s b/gas/testsuite/gas/mips/option-pic-vxworks-2.s
new file mode 100644
index 0000000..96b85c8
--- /dev/null
+++ b/gas/testsuite/gas/mips/option-pic-vxworks-2.s
@@ -0,0 +1,2 @@
+ .option pic0
+ .option pic2