This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] MIPS/GAS: Disallow `.option picX' with VxWorks PIC


These pseudo-ops are for SVR4 PIC only.

	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.
---

 I have committed this change.

  Maciej

binutils-mips-gas-pic-vxworks.diff
Index: binutils/gas/config/tc-mips.c
===================================================================
--- binutils.orig/gas/config/tc-mips.c	2016-04-09 21:03:13.171647719 +0100
+++ binutils/gas/config/tc-mips.c	2016-04-09 21:03:13.397351613 +0100
@@ -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)
 	{
Index: binutils/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils.orig/gas/testsuite/gas/mips/mips.exp	2016-04-09 21:03:13.337730309 +0100
+++ binutils/gas/testsuite/gas/mips/mips.exp	2016-04-09 21:03:23.181398375 +0100
@@ -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*]]
@@ -1483,6 +1488,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]
Index: binutils/gas/testsuite/gas/mips/option-pic-vxworks-1.l
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/gas/testsuite/gas/mips/option-pic-vxworks-1.l	2016-04-09 21:03:23.194624925 +0100
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*:1: Error: \.option pic1 not supported
+.*:2: Error: \.option pic3 not supported
Index: binutils/gas/testsuite/gas/mips/option-pic-vxworks-1.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/gas/testsuite/gas/mips/option-pic-vxworks-1.s	2016-04-09 21:03:23.237058006 +0100
@@ -0,0 +1,2 @@
+	.option	pic1
+	.option	pic3
Index: binutils/gas/testsuite/gas/mips/option-pic-vxworks-2.l
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/gas/testsuite/gas/mips/option-pic-vxworks-2.l	2016-04-09 21:03:23.258367369 +0100
@@ -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
Index: binutils/gas/testsuite/gas/mips/option-pic-vxworks-2.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/gas/testsuite/gas/mips/option-pic-vxworks-2.s	2016-04-09 21:03:23.272481464 +0100
@@ -0,0 +1,2 @@
+	.option	pic0
+	.option	pic2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]