aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.c10
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr87412-1.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr87412-2.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr87412-3.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr87412-4.c7
7 files changed, 60 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 46c918b..8289073 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2019-02-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/87412
+ * config/i386/i386.c (ix86_set_indirect_branch_type): Issue an
+ error for -mindirect-branch/-mfunction-return with incompatible
+ -fcf-protection.
+
2019-02-21 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/88714
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a58ddca..81dfed1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5667,6 +5667,11 @@ ix86_set_indirect_branch_type (tree fndecl)
((cfun->machine->indirect_branch_type
== indirect_branch_thunk_extern)
? "thunk-extern" : "thunk"));
+
+ if (cfun->machine->indirect_branch_type != indirect_branch_keep
+ && (flag_cf_protection & CF_RETURN))
+ error ("%<-mindirect-branch%> and %<-fcf-protection%> are not "
+ "compatible");
}
if (cfun->machine->function_return_type == indirect_branch_unset)
@@ -5705,6 +5710,11 @@ ix86_set_indirect_branch_type (tree fndecl)
((cfun->machine->function_return_type
== indirect_branch_thunk_extern)
? "thunk-extern" : "thunk"));
+
+ if (cfun->machine->function_return_type != indirect_branch_keep
+ && (flag_cf_protection & CF_RETURN))
+ error ("%<-mfunction-return%> and %<-fcf-protection%> are not "
+ "compatible");
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2068a41..138d603 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-02-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/87412
+ * gcc.target/i386/pr87412-1.c: New file.
+ * gcc.target/i386/pr87412-2.c: Likewise.
+ * gcc.target/i386/pr87412-3.c: Likewise.
+ * gcc.target/i386/pr87412-4.c: Likewise.
+
2019-02-20 Jakub Jelinek <jakub@redhat.com>
PR c++/89403
diff --git a/gcc/testsuite/gcc.target/i386/pr87412-1.c b/gcc/testsuite/gcc.target/i386/pr87412-1.c
new file mode 100644
index 0000000..e04f1fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87412-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcf-protection -mfunction-return=thunk -mindirect-branch=thunk" } */
+
+void
+bar (void)
+{
+/* { dg-error "'-mindirect-branch' and '-fcf-protection' are not compatible" "" { target *-*-* } .-1 } */
+/* { dg-error "'-mfunction-return' and '-fcf-protection' are not compatible" "" { target *-*-* } .-2 } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr87412-2.c b/gcc/testsuite/gcc.target/i386/pr87412-2.c
new file mode 100644
index 0000000..33a9e8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87412-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcf-protection -mfunction-return=keep -mindirect-branch=keep" } */
+
+void
+ __attribute__ ((indirect_branch("thunk"), function_return("thunk")))
+bar (void)
+{
+/* { dg-error "'-mindirect-branch' and '-fcf-protection' are not compatible" "" { target *-*-* } .-1 } */
+/* { dg-error "'-mfunction-return' and '-fcf-protection' are not compatible" "" { target *-*-* } .-2 } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr87412-3.c b/gcc/testsuite/gcc.target/i386/pr87412-3.c
new file mode 100644
index 0000000..e67d727
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87412-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcf-protection=return -mfunction-return=thunk -mindirect-branch=thunk" } */
+
+void
+bar (void)
+{
+/* { dg-error "'-mindirect-branch' and '-fcf-protection' are not compatible" "" { target *-*-* } .-1 } */
+/* { dg-error "'-mfunction-return' and '-fcf-protection' are not compatible" "" { target *-*-* } .-2 } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr87412-4.c b/gcc/testsuite/gcc.target/i386/pr87412-4.c
new file mode 100644
index 0000000..f90d2f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87412-4.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcf-protection=branch -mfunction-return=thunk -mindirect-branch=thunk" } */
+
+void
+bar (void)
+{
+}