+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
((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)
((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");
}
}
+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
--- /dev/null
+/* { 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 } */
+}
--- /dev/null
+/* { 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 } */
+}
--- /dev/null
+/* { 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 } */
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcf-protection=branch -mfunction-return=thunk -mindirect-branch=thunk" } */
+
+void
+bar (void)
+{
+}