summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips/mips-nonpic
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/mips/mips-nonpic
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/mips/mips-nonpic')
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/README27
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-1.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-10.c18
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-11.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-12.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-13.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-14.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-15.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-16.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-2.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-3.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-4.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-5.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-6.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-7.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-8.c17
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/main-9.c10
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.exp54
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.h20
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr-call.c8
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr.c8
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-call.c9
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-nothing.c7
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-receive-fn-addr.c7
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr-call.c8
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr.c8
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/pic-call.c9
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/pic-nothing.c7
-rw-r--r--gcc/testsuite/gcc.target/mips/mips-nonpic/pic-receive-fn-addr.c7
29 files changed, 445 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/README b/gcc/testsuite/gcc.target/mips/mips-nonpic/README
new file mode 100644
index 000000000..1b42becbe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/README
@@ -0,0 +1,27 @@
+These tests are meant to test the interoperability of PIC and nonpic objects for mips.
+This table shows the various combinations and each case is tested by one of the nonpic tests.
+Test Case The PIC code The non-PIC code The result (stub and/or PLT)
+
+main-1.c nothing nothing Neither (trivial)
+main-2.c nothing call only PLT entry
+main-3.c nothing address taken only Neither (* But creating a PLT entry is valid)
+main-4.c nothing address and call PLT entry
+main-5.c call only nothing .MIPS.stubs entry
+main-6.c call only call only .MIPS.stubs and PLT
+main-7.c call only address taken only .MIPS.stubs (* Also creating a PLT entry is valid)
+main-8.c call only address and call .MIPS.stubs and PLT entry
+main-9.c address taken only nothing Neither
+main-10.c address taken only call only PLT entry
+main-11.c address taken only address taken only Neither (* But creating a PLT entry is valid)
+main-12.c address taken only address and call PLT entry
+main-13.c address and call nothing Neither
+main-14.c address and call call only PLT entry
+main-15.c address and call address taken only Neither (* But creating a PLT entry is valid)
+main-16.c address and call address and call PLT entry
+
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-1.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-1.c
new file mode 100644
index 000000000..2f428717a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-1.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-nothing.o nonpic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_nothing ();
+ pic_nothing ();
+
+ if (hit_nonpic_nothing != 1)
+ abort ();
+
+ if (hit_pic_nothing != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-10.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-10.c
new file mode 100644
index 000000000..6c3601861
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-10.c
@@ -0,0 +1,18 @@
+/* { dg-options "nonpic-call.o pic-addr.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_call ();
+ pic_addr ();
+
+ if (hit_nonpic_call != 1)
+ abort ();
+
+ if (hit_pic_addr != 2)
+ abort ();
+
+ exit (0);
+
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-11.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-11.c
new file mode 100644
index 000000000..1d8a6d20c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-11.c
@@ -0,0 +1,17 @@
+/* { dg-options "nonpic-addr.o pic-addr.o nonpic-receive-fn-addr.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_addr ();
+ pic_addr ();
+
+ if (hit_nonpic_addr != 1)
+ abort ();
+
+ if (hit_pic_addr != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-12.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-12.c
new file mode 100644
index 000000000..f57b5ce17
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-12.c
@@ -0,0 +1,17 @@
+/* { dg-options "nonpic-addr-call.o pic-addr.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_addr_call ();
+ pic_addr ();
+
+ if (hit_nonpic_addr_call != 1)
+ abort ();
+
+ if (hit_pic_addr != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-13.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-13.c
new file mode 100644
index 000000000..d2b88e1f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-13.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-addr-call.o nonpic-receive-fn-addr.o nonpic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_nothing ();
+ pic_addr_call ();
+
+ if (hit_nonpic_nothing != 1)
+ abort ();
+
+ if (hit_pic_addr_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-14.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-14.c
new file mode 100644
index 000000000..6318a2240
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-14.c
@@ -0,0 +1,17 @@
+/* { dg-options "nonpic-call.o pic-addr.o pic-receive-fn-addr.o pic-addr-call.o nonpic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_call ();
+ pic_addr_call ();
+
+ if (hit_nonpic_call != 1)
+ abort ();
+
+ if (hit_pic_addr_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-15.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-15.c
new file mode 100644
index 000000000..1c165043a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-15.c
@@ -0,0 +1,17 @@
+/* { dg-options "nonpic-addr.o pic-receive-fn-addr.o pic-addr-call.o nonpic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_addr ();
+ pic_addr_call ();
+
+ if (hit_nonpic_addr != 1)
+ abort ();
+
+ if (hit_pic_addr_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-16.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-16.c
new file mode 100644
index 000000000..3119979d3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-16.c
@@ -0,0 +1,17 @@
+/* { dg-options "nonpic-addr-call.o pic-receive-fn-addr.o pic-addr-call.o nonpic-receive-fn-addr.o pic-nothing.o nonpic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_addr_call ();
+ pic_addr_call ();
+
+ if (hit_nonpic_addr_call != 1)
+ abort ();
+
+ if (hit_pic_addr_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-2.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-2.c
new file mode 100644
index 000000000..8a66e7a7a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-2.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-addr.o nonpic-call.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_call ();
+ pic_nothing ();
+
+ if (hit_nonpic_call != 1)
+ abort ();
+
+ if (hit_pic_nothing != 2)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-3.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-3.c
new file mode 100644
index 000000000..c9c8dac70
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-3.c
@@ -0,0 +1,17 @@
+/* { dg-options "nonpic-addr.o nonpic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_addr ();
+ pic_nothing ();
+
+ if (hit_nonpic_addr != 1)
+ abort ();
+
+ if (hit_pic_nothing != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-4.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-4.c
new file mode 100644
index 000000000..c10c213ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-4.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-addr.o pic-receive-fn-addr.o nonpic-addr-call.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_addr_call ();
+ pic_nothing ();
+
+ if (hit_nonpic_addr_call != 1)
+ abort ();
+
+ if (hit_pic_nothing != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-5.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-5.c
new file mode 100644
index 000000000..9b6dd8aff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-5.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-addr.o pic-call.o nonpic-addr.o pic-receive-fn-addr.o nonpic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ nonpic_nothing ();
+ pic_call ();
+
+ if (hit_nonpic_nothing != 2)
+ abort ();
+
+ if (hit_pic_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-6.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-6.c
new file mode 100644
index 000000000..90b220f0f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-6.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-call.o nonpic-call.o nonpic-addr.o pic-addr.o nonpic-receive-fn-addr.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ pic_call ();
+ nonpic_call ();
+
+ if (hit_pic_call != 1)
+ abort ();
+
+ if (hit_nonpic_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-7.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-7.c
new file mode 100644
index 000000000..8cef63f3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-7.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-call.o nonpic-addr.o nonpic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ pic_call ();
+ nonpic_addr ();
+
+ if (hit_pic_call != 1)
+ abort ();
+
+ if (hit_nonpic_addr != 2)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-8.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-8.c
new file mode 100644
index 000000000..0200bf2dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-8.c
@@ -0,0 +1,17 @@
+/* { dg-options "pic-call.o nonpic-addr-call.o nonpic-addr.o nonpic-receive-fn-addr.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ pic_call ();
+ nonpic_addr_call ();
+
+ if (hit_pic_call != 1)
+ abort ();
+
+ if (hit_nonpic_addr_call != 1)
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/main-9.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-9.c
new file mode 100644
index 000000000..4144172cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/main-9.c
@@ -0,0 +1,10 @@
+/* { dg-options "pic-addr.o pic-receive-fn-addr.o nonpic-nothing.o pic-nothing.o" } */
+
+#include "mips-nonpic.h"
+
+main ()
+{
+ pic_addr ();
+ nonpic_nothing ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.exp b/gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.exp
new file mode 100644
index 000000000..47443acda
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.exp
@@ -0,0 +1,54 @@
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+load_lib gcc-dg.exp
+load_lib target-supports.exp
+
+# Exit immediately if this isn't a MIPS target.
+if ![istarget mips*-*-*] {
+ return
+}
+
+# Pic and nonpic are not link-compatible for VXWorks targets.
+if [istarget mips*-*-vxworks] {
+ return
+}
+
+if { ![check_effective_target_fpic] } {
+ return
+}
+
+dg-init
+
+set old-dg-do-what-default "${dg-do-what-default}"
+set dg-do-what-default "assemble"
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/pic-*.c]] {
+ verbose "Compiling [file tail [file dirname $testcase]]/[file tail $testcase]"
+ dg-test -keep-output $testcase "-fpic" ""
+}
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/nonpic-*.c]] {
+ verbose "Compiling [file tail [file dirname $testcase]]/[file tail $testcase]"
+ dg-test -keep-output $testcase "-fno-pic" ""
+}
+
+set dg-do-what-default "run"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/main-*.c]] "-fno-pic" ""
+
+set dg-do-what-default "${old-dg-do-what-default}"
+dg-finish
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.h b/gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.h
new file mode 100644
index 000000000..e9fe99218
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/mips-nonpic.h
@@ -0,0 +1,20 @@
+extern int hit_pic_addr;
+extern int hit_pic_addr_call;
+extern int hit_pic_nothing;
+extern int hit_pic_call;
+
+extern int hit_nonpic_addr;
+extern int hit_nonpic_addr_call;
+extern int hit_nonpic_call;
+extern int hit_nonpic_nothing;
+
+extern void nonpic_addr (void);
+extern void nonpic_nothing (void);
+extern void nonpic_receive_fn_addr (void *);
+
+extern void pic_addr (void);
+extern void pic_receive_fn_addr (void *);
+extern void pic_nothing (void);
+
+extern void abort (void);
+extern void exit (int);
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr-call.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr-call.c
new file mode 100644
index 000000000..19d0e4349
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr-call.c
@@ -0,0 +1,8 @@
+#include "mips-nonpic.h"
+int hit_nonpic_addr_call = 0;
+void
+nonpic_addr_call (void)
+{
+ hit_nonpic_addr_call++;
+ pic_receive_fn_addr (&pic_nothing);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr.c
new file mode 100644
index 000000000..c919e83b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-addr.c
@@ -0,0 +1,8 @@
+#include "mips-nonpic.h"
+int hit_nonpic_addr = 0;
+void
+nonpic_addr ()
+{
+ nonpic_receive_fn_addr (&nonpic_nothing);
+ hit_nonpic_addr++;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-call.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-call.c
new file mode 100644
index 000000000..8d368b42e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-call.c
@@ -0,0 +1,9 @@
+#include "mips-nonpic.h"
+int hit_nonpic_call = 0;
+void
+nonpic_call ()
+{
+ pic_nothing ();
+ pic_addr ();
+ hit_nonpic_call++;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-nothing.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-nothing.c
new file mode 100644
index 000000000..90356fb24
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-nothing.c
@@ -0,0 +1,7 @@
+#include "mips-nonpic.h"
+int hit_nonpic_nothing = 0;
+void
+nonpic_nothing ()
+{
+ hit_nonpic_nothing++;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-receive-fn-addr.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-receive-fn-addr.c
new file mode 100644
index 000000000..8b548c9ef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/nonpic-receive-fn-addr.c
@@ -0,0 +1,7 @@
+#include "mips-nonpic.h"
+void
+nonpic_receive_fn_addr (void *x)
+{
+ if (x != &nonpic_nothing)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr-call.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr-call.c
new file mode 100644
index 000000000..2db729392
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr-call.c
@@ -0,0 +1,8 @@
+#include "mips-nonpic.h"
+int hit_pic_addr_call = 0;
+void
+pic_addr_call (void)
+{
+ hit_pic_addr_call++;
+ nonpic_receive_fn_addr (&nonpic_nothing);
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr.c
new file mode 100644
index 000000000..a90739235
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-addr.c
@@ -0,0 +1,8 @@
+#include "mips-nonpic.h"
+int hit_pic_addr = 0;
+void
+pic_addr ()
+{
+ pic_receive_fn_addr (&pic_nothing);
+ hit_pic_addr++;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-call.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-call.c
new file mode 100644
index 000000000..0c73b9333
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-call.c
@@ -0,0 +1,9 @@
+#include "mips-nonpic.h"
+int hit_pic_call = 0;
+void
+pic_call ()
+{
+ nonpic_nothing ();
+ nonpic_addr ();
+ hit_pic_call++;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-nothing.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-nothing.c
new file mode 100644
index 000000000..3e4539081
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-nothing.c
@@ -0,0 +1,7 @@
+#include "mips-nonpic.h"
+int hit_pic_nothing = 0;
+void
+pic_nothing ()
+{
+ hit_pic_nothing++;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-receive-fn-addr.c b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-receive-fn-addr.c
new file mode 100644
index 000000000..4a40e0a18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/mips-nonpic/pic-receive-fn-addr.c
@@ -0,0 +1,7 @@
+#include "mips-nonpic.h"
+void
+pic_receive_fn_addr (void *x)
+{
+ if (x != &pic_nothing)
+ abort ();
+}