predicates.md ("bras_sym_operand"): Do not accept nonlocal function symbols if flag_pic.
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 23 Oct 2006 13:38:50 +0000 (13:38 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Mon, 23 Oct 2006 13:38:50 +0000 (13:38 +0000)
ChangeLog:

* config/s390/predicates.md ("bras_sym_operand"): Do not accept
nonlocal function symbols if flag_pic.

testsuite/ChangeLog:

* g++.dg/other/s390-1.C: New testcase.

From-SVN: r117973

gcc/ChangeLog
gcc/config/s390/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/s390-1.C [new file with mode: 0644]

index 568ba2e78f5657e41ab8ac13cc84de5b62bb4369..4c022e5071b53ea752499e1cd41b36fc8b180eae 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-23  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * config/s390/predicates.md ("bras_sym_operand"): Do not accept
+       nonlocal function symbols if flag_pic.
+
 2006-10-23  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/27132
index de6e796318dc2a0ff2e40bc69425b82fa59fc100..5f9e8d4389205322920c539e45f3152a55df9e40 100644 (file)
@@ -62,7 +62,8 @@
 ;; Allow SYMBOL_REFs and @PLT stubs.
 
 (define_special_predicate "bras_sym_operand"
-  (ior (match_code "symbol_ref")
+  (ior (and (match_code "symbol_ref")
+           (match_test "!flag_pic || SYMBOL_REF_LOCAL_P (op)"))
        (and (match_code "const")
            (and (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
                 (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_PLT")))))
index b8b1c525dd44865558c7bd1a02d2ebed8b0ed891..b5cd9012f62f587160a5e3360cf48f375006ddd8 100644 (file)
@@ -1,3 +1,7 @@
+2006-10-23  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * g++.dg/other/s390-1.C: New testcase.
+
 2006-10-23  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/27132
diff --git a/gcc/testsuite/g++.dg/other/s390-1.C b/gcc/testsuite/g++.dg/other/s390-1.C
new file mode 100644 (file)
index 0000000..bf37ca4
--- /dev/null
@@ -0,0 +1,32 @@
+// { dg-do compile { target s390x-*-* } }
+// { dg-options "-O3 -fPIC" }
+
+class A
+{
+public:
+  void f (void) { _M_a = 0; }
+  void g (void) { _M_a = 1; }
+  void h (void);
+
+private:
+  int _M_a;
+};
+
+class B : virtual public A
+{
+};
+
+void
+test (B& x)
+{
+  for (int i = 0; i < 17; i++)
+   {
+     x.f ();
+     (x.*&A::g) ();
+     x.h ();
+   }
+}
+
+// Check that every call to A::g goes via the PLT.
+// { dg-final { scan-assembler-not "brasl\[^@\]*\n" } }
+