@@ -705,8 +705,13 @@ bpf_output_call (rtx target)
break;
}
default:
- error ("indirect call in function, which are not supported by eBPF");
- output_asm_insn ("call 0", NULL);
+ if (TARGET_XBPF)
+ output_asm_insn ("call\t%0", &target);
+ else
+ {
+ error ("indirect call in function, which are not supported by eBPF");
+ output_asm_insn ("call 0", NULL);
+ }
break;
}
@@ -22,7 +22,7 @@
/**** Controlling the Compilation Driver. */
-#define ASM_SPEC "%{mbig-endian:-EB} %{!mbig-endian:-EL}"
+#define ASM_SPEC "%{mbig-endian:-EB} %{!mbig-endian:-EL} %{mxbpf:-mxbpf}"
#define LINK_SPEC "%{mbig-endian:-EB} %{!mbig-endian:-EL}"
#define LIB_SPEC ""
#define STARTFILE_SPEC ""
new file mode 100644
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-mxbpf" } */
+
+/* GCC should generate an indirect call instruction (call %REG)
+ when targetting xBPF. */
+
+void
+foo ()
+{
+ ;
+}
+
+void
+bar()
+{
+ void (*funp) () = &foo;
+
+ (*funp) ();
+}
+
+/* { dg-final { scan-assembler "call\t%r" } } */