diff mbox series

[V6,04/11] testsuite: new require effective target indirect_calls

Message ID 20190829151347.13536-5-jose.marchesi@oracle.com
State New
Headers show
Series eBPF support for GCC | expand

Commit Message

Jose E. Marchesi Aug. 29, 2019, 3:13 p.m. UTC
This patch adds a new dg_require_effective_target procedure to the
testsuite infrastructure: indirect_calls.  This new function tells
whether a target supports calls to non-constant call targets.

This patch also annotates the tests in the gcc.c-torture testuite that
require support for indirect calls.

gcc/ChangeLog:

	* doc/sourcebuild.texi (Effective-Target Keywords): Document
	indirect_calls.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_indirect_calls):
	New proc.
	* gcc.c-torture/compile/20010102-1.c: Annotate with
	dg-require-effective-target indirect_calls.
	* gcc.c-torture/compile/20010107-1.c: Likewise.
	* gcc.c-torture/compile/20011109-1.c: Likewise.
	* gcc.c-torture/compile/20011218-1.c: Likewise.
	* gcc.c-torture/compile/20011229-1.c: Likewise.
	* gcc.c-torture/compile/20020129-1.c: Likewise.
	* gcc.c-torture/compile/20020320-1.c: Likewise.
	* gcc.c-torture/compile/20020706-1.c: Likewise.
	* gcc.c-torture/compile/20020706-2.c: Likewise.
	* gcc.c-torture/compile/20021205-1.c: Likewise.
	* gcc.c-torture/compile/20030921-1.c: Likewise.
	* gcc.c-torture/compile/20031023-1.c: Likewise.
	* gcc.c-torture/compile/20031023-2.c: Likewise.
	* gcc.c-torture/compile/20031023-3.c: Likewise.
	* gcc.c-torture/compile/20031023-4.c: Likewise.
	* gcc.c-torture/compile/20040614-1.c: Likewise.
	* gcc.c-torture/compile/20040909-1.c: Likewise.
	* gcc.c-torture/compile/20050122-1.c: Likewise.
	* gcc.c-torture/compile/20050202-1.c: Likewise.
	* gcc.c-torture/compile/20060208-1.c: Likewise.
	* gcc.c-torture/compile/20081108-1.c: Likewise.
	* gcc.c-torture/compile/20150327.c: Likewise.
	* gcc.c-torture/compile/920428-2.c: Likewise.
	* gcc.c-torture/compile/920928-5.c: Likewise.
	* gcc.c-torture/compile/930117-1.c: Likewise.
	* gcc.c-torture/compile/930607-1.c: Likewise.
	* gcc.c-torture/compile/991213-2.c: Likewise.
	* gcc.c-torture/compile/callind.c: Likewise.
	* gcc.c-torture/compile/calls-void.c: Likewise.
	* gcc.c-torture/compile/calls.c: Likewise.
	* gcc.c-torture/compile/pr21840.c: Likewise.
	* gcc.c-torture/compile/pr32139.c: Likewise.
	* gcc.c-torture/compile/pr35607.c: Likewise.
	* gcc.c-torture/compile/pr37433-1.c: Likewise.
	* gcc.c-torture/compile/pr37433.c: Likewise.
	* gcc.c-torture/compile/pr39941.c: Likewise.
	* gcc.c-torture/compile/pr40080.c: Likewise.
	* gcc.c-torture/compile/pr43635.c: Likewise.
	* gcc.c-torture/compile/pr43791.c: Likewise.
	* gcc.c-torture/compile/pr43845.c: Likewise.
	* gcc.c-torture/compile/pr44043.c: Likewise.
	* gcc.c-torture/compile/pr51694.c: Likewise.
	* gcc.c-torture/compile/pr77754-2.c: Likewise.
	* gcc.c-torture/compile/pr77754-3.c: Likewise.
	* gcc.c-torture/compile/pr77754-4.c: Likewise.
	* gcc.c-torture/compile/pr89663-2.c: Likewise.
	* gcc.c-torture/compile/pta-1.c: Likewise.
	* gcc.c-torture/compile/stack-check-1.c: Likewise.
	* gcc.dg/Walloc-size-larger-than-18.c: Likewise.
---
 gcc/ChangeLog                                      |  5 ++
 gcc/doc/sourcebuild.texi                           |  4 ++
 gcc/testsuite/ChangeLog                            | 55 ++++++++++++++++++++++
 gcc/testsuite/gcc.c-torture/compile/20010102-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20010107-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20011109-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20011218-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20011229-1.c   |  3 ++
 gcc/testsuite/gcc.c-torture/compile/20020129-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20020320-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20020706-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20020706-2.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20021205-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20030921-1.c   |  1 +
 gcc/testsuite/gcc.c-torture/compile/20031023-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20031023-2.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20031023-3.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20031023-4.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20040614-1.c   |  1 +
 gcc/testsuite/gcc.c-torture/compile/20040909-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20050122-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20050202-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20060208-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20081108-1.c   |  2 +
 gcc/testsuite/gcc.c-torture/compile/20150327.c     |  2 +
 gcc/testsuite/gcc.c-torture/compile/920428-2.c     |  2 +
 gcc/testsuite/gcc.c-torture/compile/920928-5.c     |  3 ++
 gcc/testsuite/gcc.c-torture/compile/930117-1.c     |  2 +
 gcc/testsuite/gcc.c-torture/compile/930607-1.c     |  2 +
 gcc/testsuite/gcc.c-torture/compile/991213-2.c     |  2 +
 gcc/testsuite/gcc.c-torture/compile/callind.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/calls-void.c   |  1 +
 gcc/testsuite/gcc.c-torture/compile/calls.c        |  1 +
 gcc/testsuite/gcc.c-torture/compile/pr21840.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr32139.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr35607.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr37433-1.c    |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr37433.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr39941.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr40080.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr43635.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr43791.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr43845.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr44043.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr51694.c      |  2 +
 gcc/testsuite/gcc.c-torture/compile/pr77754-2.c    |  1 +
 gcc/testsuite/gcc.c-torture/compile/pr77754-3.c    |  1 +
 gcc/testsuite/gcc.c-torture/compile/pr77754-4.c    |  1 +
 gcc/testsuite/gcc.c-torture/compile/pr89663-2.c    |  1 +
 gcc/testsuite/gcc.c-torture/compile/pta-1.c        |  2 +
 .../gcc.c-torture/compile/stack-check-1.c          |  1 +
 gcc/testsuite/gcc.dg/Walloc-size-larger-than-18.c  |  1 +
 gcc/testsuite/lib/target-supports.exp              |  8 ++++
 53 files changed, 162 insertions(+)

Comments

Jose E. Marchesi Sept. 9, 2019, 9:56 a.m. UTC | #1
This patch adds a new dg_require_effective_target procedure to the
    testsuite infrastructure: indirect_calls.  This new function tells
    whether a target supports calls to non-constant call targets.
    
    This patch also annotates the tests in the gcc.c-torture testuite that
    require support for indirect calls.

As this implements a solution proposed by a global maintainer and I
didn't get any further comments on it, I just installed it in its own
commit in svn trunk.

Salud!
Mike Stump Sept. 11, 2019, 6:55 p.m. UTC | #2
On Aug 29, 2019, at 8:13 AM, Jose E. Marchesi <jose.marchesi@oracle.com> wrote:
> 
> This patch adds a new dg_require_effective_target procedure to the
> testsuite infrastructure: indirect_calls.  This new function tells
> whether a target supports calls to non-constant call targets.

Ok.  I'll let people contemplate some comments...

I'm torn between targets that can't support C and gooping up the test suite and approving.  I'll error on the side of approving this, but, would like to hear from folks if I go to far.

Since they are easy to identify, maintain and ignore...  I went with approval.

People can contemplate other ways to do this, like introduce a fake marker for when the feature is used and when running a program with such a marker, then mark it as unsupported.  This way, no test need be marked, and all future test cases that use the feature, just flip to unsupported, no maintenance required.

We do this sort of thing with programs that overflow the RAM, by using a stylized error message from ld, and noticing that in dejagnu, and then not expecting it to work.

If you can find a way to tally stack space, and check it before running it, the other change to tightly track stack space then would not be as necessary.  I think you might be able to do this on your target.  Having the stack space marked is generally useful for other targets, as most won't have a nice way to  sort out small stacks, so my general comment apply less to the stack size, but, things that can cause you less maintenance burden are likely good in any event.
Jose E. Marchesi Sept. 11, 2019, 8:47 p.m. UTC | #3
Hi Mike.
Thanks for the review.

    On Aug 29, 2019, at 8:13 AM, Jose E. Marchesi <jose.marchesi@oracle.com> wrote:
    > 
    > This patch adds a new dg_require_effective_target procedure to the
    > testsuite infrastructure: indirect_calls.  This new function tells
    > whether a target supports calls to non-constant call targets.
    
    Ok.  I'll let people contemplate some comments...
    
    I'm torn between targets that can't support C and gooping up the test
    suite and approving.  I'll error on the side of approving this, but,
    would like to hear from folks if I go to far.
    
    Since they are easy to identify, maintain and ignore...  I went with
    approval.
    
    People can contemplate other ways to do this, like introduce a fake
    marker for when the feature is used and when running a program with
    such a marker, then mark it as unsupported.  This way, no test need be
    marked, and all future test cases that use the feature, just flip to
    unsupported, no maintenance required.
    
    We do this sort of thing with programs that overflow the RAM, by using
    a stylized error message from ld, and noticing that in dejagnu, and
    then not expecting it to work.
    
    If you can find a way to tally stack space, and check it before
    running it, the other change to tightly track stack space then would
    not be as necessary.  I think you might be able to do this on your
    target.  Having the stack space marked is generally useful for other
    targets, as most won't have a nice way to sort out small stacks, so my
    general comment apply less to the stack size, but, things that can
    cause you less maintenance burden are likely good in any event.

I am working on a new compilation mode for what I call xbpf, which is
basically eBPF plus extensions to eliminate the current restrictions to
C.  The purpose of -mxbpf is mainly to test the compiler.  Once the
support is in, I will revert this and similar other patches.

J.
Mike Stump Sept. 12, 2019, 12:43 a.m. UTC | #4
On Sep 11, 2019, at 1:47 PM, Jose E. Marchesi <jose.marchesi@oracle.com> wrote:
> 
> I am working on a new compilation mode for what I call xbpf, which is
> basically eBPF plus extensions to eliminate the current restrictions to
> C.  The purpose of -mxbpf is mainly to test the compiler.  Once the
> support is in, I will revert this and similar other patches.

Yeah, not a bad way to do it.  I have a machine with limits on certain memories in hardware that trip up gcc's testsuite, and in my simulator, I have a special gcc testing mode that simply gives me a ton more memory (17 MB) that on real hardware, I don't have.  This let's me easily test under simulation without worrying about the limits.  I can also have my simulator select the small mode to reflect what hardware does, and everything else uses this.  Best of both world.
diff mbox series

Patch

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index f9fcd0916b3..88917ea77d3 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2377,6 +2377,10 @@  Target supports @code{wchar_t} that is compatible with @code{char32_t}.
 
 @item comdat_group
 Target uses comdat groups.
+
+@item indirect_calls
+Target supports indirect calls, i.e. calls where the target is not
+constant.
 @end table
 
 @subsubsection Local to tests in @code{gcc.target/i386}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010102-1.c b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c
index a409b566098..3d9cc9edf72 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20010102-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c
@@ -4,6 +4,8 @@ 
 
    Copyright (C) 2001  Free Software Foundation.  */
 
+/* { dg-require-effective-target indirect_calls } */
+
 # define PTR_INT_TYPE __PTRDIFF_TYPE__
 
 struct _obstack_chunk
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010107-1.c b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c
index 222def4d9ef..22461a0521f 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20010107-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 unsigned long x[4];
 
 void foo(void)
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011109-1.c b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c
index f1987a74bf2..1deba2a52df 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20011109-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef struct { short x[4]; } S;
 typedef struct { unsigned int a, b, c; S *d; } T;
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011218-1.c b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c
index bf63489b855..8db5b777089 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20011218-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c
@@ -2,6 +2,8 @@ 
    for the indirect call was exposed too early and reload couldn't
    allocate it for multiplication and division.  */
 
+/* { dg-require-effective-target indirect_calls } */
+
 struct S {
   int a, b;
   void (*f) (long, int);
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-1.c b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c
index 97b2655434a..99aeab7d7cd 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20011229-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c
@@ -1,5 +1,8 @@ 
 /* ICE: call insn does not satisfy its constraints, MMIX port.
    Origin: ghostscript-6.52, reduction from hp@bitrange.com.  */
+
+/* { dg-require-effective-target indirect_calls } */
+
 struct s0
 {
   void (*init_color)(void *, void *);
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
index 7b17ba475e4..c14ac07655e 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
@@ -1,5 +1,7 @@ 
 /* Test call to static variable.  */
 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef struct
 {
   long long a[10];
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c
index 385c061e193..5b7a17a3080 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c
@@ -2,6 +2,8 @@ 
    This testcase caused infinite loop in flow (several places),
    because flow assumes gen_jump generates simple_jump_p.  */
 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef void (*T) (void);
 extern T x[];
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-1.c b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c
index c8811bc68ff..9bbfc8a66dd 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020706-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c
@@ -1,6 +1,8 @@ 
 // Contributed by Alexandre Oliva <aoliva@redhat.com>
 // From Red Hat case 106165.
 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef struct s1
 {
   unsigned short v1;
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-2.c b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c
index b84dda60fd3..2391f2085e8 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020706-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c
@@ -1,6 +1,8 @@ 
 // Contributed by Alexandre Oliva <aoliva@redhat.com>
 // From Red Hat case 106165.
 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short);
 
 void crashIt(int id, FUNC_P *func, unsigned char *funcparm)
diff --git a/gcc/testsuite/gcc.c-torture/compile/20021205-1.c b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c
index 73648e94951..27f45875108 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20021205-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef struct x x;
 extern void *baz(char *);
 struct x { char * (*bar) (int); };
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030921-1.c b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c
index 8199dc657f2..4bb3f4645af 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20030921-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c
@@ -2,6 +2,7 @@ 
    f is not being emitted. TREE_SYMBOL_REFERENCED was being set
    instead of calling mark_referenced.  */
 
+/* { dg-require-effective-target indirect_calls } */
 
 static void f(void);
 void g(void (*x) (void)){x();}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-1.c b/gcc/testsuite/gcc.c-torture/compile/20031023-1.c
index be837762e66..1ee1ff7aaa6 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20031023-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20031023-1.c
@@ -1,5 +1,7 @@ 
 /* Declaration of the frame size doesn't work on ptx.  */
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
 #ifndef ASIZE
 # define ASIZE 0x10000000000UL
 #endif
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-2.c b/gcc/testsuite/gcc.c-torture/compile/20031023-2.c
index 66d66458c85..50965169adc 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20031023-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20031023-2.c
@@ -1,4 +1,6 @@ 
 /* Declaration of the frame size doesn't work on ptx.  */
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
 #define ASIZE 0x1000000000UL
 #include "20031023-1.c"
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-3.c b/gcc/testsuite/gcc.c-torture/compile/20031023-3.c
index 5859634c343..1bb692f45a9 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20031023-3.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20031023-3.c
@@ -1,4 +1,6 @@ 
 /* Declaration of the frame size doesn't work on ptx.  */
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
 #define ASIZE 0x100000000UL
 #include "20031023-1.c"
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-4.c b/gcc/testsuite/gcc.c-torture/compile/20031023-4.c
index 5c61f3743d4..85c4dca9cb5 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20031023-4.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20031023-4.c
@@ -1,2 +1,4 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 #define ASIZE 0x80000000UL
 #include "20031023-1.c"
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040614-1.c b/gcc/testsuite/gcc.c-torture/compile/20040614-1.c
index b692ab569f2..c889bb251c8 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20040614-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20040614-1.c
@@ -1,4 +1,5 @@ 
 /* { dg-require-effective-target label_values } */
+/* { dg-require-effective-target indirect_calls } */
 
 void f(int r1, int *fp) 
 {     
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040909-1.c b/gcc/testsuite/gcc.c-torture/compile/20040909-1.c
index 8bbf90191b4..0f66cb261db 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20040909-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20040909-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 static __inline__ int
 one_utf8_to_utf16 () { }
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20050122-1.c b/gcc/testsuite/gcc.c-torture/compile/20050122-1.c
index a70907d9051..7bb7cee5a32 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20050122-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20050122-1.c
@@ -1,4 +1,6 @@ 
 /* From PR 19484.  */
+/* { dg-require-effective-target indirect_calls } */
+
 extern void foo (void) __attribute__((noreturn));
 int n;
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20050202-1.c b/gcc/testsuite/gcc.c-torture/compile/20050202-1.c
index b3f81764538..58ed54eceb3 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20050202-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20050202-1.c
@@ -1,4 +1,6 @@ 
 /* From PR 19578.  */
+/* { dg-require-effective-target indirect_calls } */
+
 extern void foo (void) __attribute__((noreturn));
 
 void
diff --git a/gcc/testsuite/gcc.c-torture/compile/20060208-1.c b/gcc/testsuite/gcc.c-torture/compile/20060208-1.c
index 3881474f722..5025463d7ef 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20060208-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20060208-1.c
@@ -1,5 +1,7 @@ 
 /* PR middle-end/26092 */
+/* { dg-require-effective-target indirect_calls } */
 /* { dg-skip-if "can't take address of malloc" { nvptx-*-* } } */
+
 typedef __SIZE_TYPE__ size_t;
 extern void *malloc (size_t);
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-1.c b/gcc/testsuite/gcc.c-torture/compile/20081108-1.c
index 3209a90c83b..a1f54e8c5fe 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20081108-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20081108-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 /* Test function call with function designator involving VLA
    side-effects does not lead to an ICE.  */
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20150327.c b/gcc/testsuite/gcc.c-torture/compile/20150327.c
index 373ea6183c3..125b722a6eb 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20150327.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20150327.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 int a;
 int (*b)(), (*c)();
 int fn1(int p1) {
diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-2.c b/gcc/testsuite/gcc.c-torture/compile/920428-2.c
index f313b32986b..817fff061e9 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920428-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920428-2.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 double sin(double x);
 double cos(double x);
 double tan(double x);
diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-5.c b/gcc/testsuite/gcc.c-torture/compile/920928-5.c
index 8c975f0c051..b9f9dcbaeb0 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920928-5.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920928-5.c
@@ -1,4 +1,7 @@ 
 /* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */
+
+/* { dg-require-effective-target indirect_calls } */
+
 struct b{};
 f(struct b(*f)())
 {
diff --git a/gcc/testsuite/gcc.c-torture/compile/930117-1.c b/gcc/testsuite/gcc.c-torture/compile/930117-1.c
index 83317cdd07b..06466f5e587 100644
--- a/gcc/testsuite/gcc.c-torture/compile/930117-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/930117-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 f(x)
 {
   (*(void (*)())&x)();
diff --git a/gcc/testsuite/gcc.c-torture/compile/930607-1.c b/gcc/testsuite/gcc.c-torture/compile/930607-1.c
index 97c94b25ec3..360bbbc1508 100644
--- a/gcc/testsuite/gcc.c-torture/compile/930607-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/930607-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef void f ();
 typedef f *pf;
 long long i;
diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-2.c b/gcc/testsuite/gcc.c-torture/compile/991213-2.c
index 98385d56263..dfbedf7d674 100644
--- a/gcc/testsuite/gcc.c-torture/compile/991213-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/991213-2.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef long		__kernel_time_t;
 typedef __kernel_time_t		time_t;
 time2(
diff --git a/gcc/testsuite/gcc.c-torture/compile/callind.c b/gcc/testsuite/gcc.c-torture/compile/callind.c
index 5938d1b88fc..893f4e764ac 100644
--- a/gcc/testsuite/gcc.c-torture/compile/callind.c
+++ b/gcc/testsuite/gcc.c-torture/compile/callind.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 bar (foo, a)
      int (**foo) ();
 {
diff --git a/gcc/testsuite/gcc.c-torture/compile/calls-void.c b/gcc/testsuite/gcc.c-torture/compile/calls-void.c
index eeed4fdfdc1..7e6f56c16fb 100644
--- a/gcc/testsuite/gcc.c-torture/compile/calls-void.c
+++ b/gcc/testsuite/gcc.c-torture/compile/calls-void.c
@@ -1,5 +1,6 @@ 
 /* { dg-require-effective-target ptr32plus } */
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
 
 typedef void  (*T)(void);
 f1 ()
diff --git a/gcc/testsuite/gcc.c-torture/compile/calls.c b/gcc/testsuite/gcc.c-torture/compile/calls.c
index ca07122a786..48a3b7c77a5 100644
--- a/gcc/testsuite/gcc.c-torture/compile/calls.c
+++ b/gcc/testsuite/gcc.c-torture/compile/calls.c
@@ -1,5 +1,6 @@ 
 /* { dg-require-effective-target ptr32plus } */
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
 
 typedef void  *(*T)(void);
 f1 ()
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21840.c b/gcc/testsuite/gcc.c-torture/compile/pr21840.c
index bec3d6bf5d7..f6f2a5dc133 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr21840.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21840.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 void fn_show_state(void);
 typedef void (*fn_handler_fn)(void);
 static fn_handler_fn fn_handler[1];
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32139.c b/gcc/testsuite/gcc.c-torture/compile/pr32139.c
index 7b8522f5174..3cc541cb328 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr32139.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr32139.c
@@ -1,4 +1,6 @@ 
 /* PR tree-optimization/32139 */
+/* { dg-require-effective-target indirect_calls } */
+
 int foo (void);
 int bar (void) __attribute__ ((const));
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35607.c b/gcc/testsuite/gcc.c-torture/compile/pr35607.c
index 7f5aa7a2b7c..9debd46df58 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr35607.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr35607.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 extern void (*__fini_array_start []) (void);
 extern void (*__fini_array_end []) (void);
 void
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
index 322c167d682..48a57b637d7 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 void regex_subst(void)
 {
   const void *subst = "";
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433.c b/gcc/testsuite/gcc.c-torture/compile/pr37433.c
index 0ba1179886c..95d168afa2f 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr37433.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 int regex_subst(void)
 {
   const void *subst = "";
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39941.c b/gcc/testsuite/gcc.c-torture/compile/pr39941.c
index b6209086be9..5cb3b0554ee 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr39941.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39941.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef void (*entry_func) (void) __attribute__ ((noreturn));
 extern entry_func entry_addr;
 static void bsd_boot_entry (void)
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40080.c b/gcc/testsuite/gcc.c-torture/compile/pr40080.c
index e36f14273e8..37c5a918ad4 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr40080.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr40080.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 extern void *ff(void*,int);
 
 struct lpgl { struct lpgl *next; };
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43635.c b/gcc/testsuite/gcc.c-torture/compile/pr43635.c
index df826b6f4c0..3875f4efcd4 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr43635.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr43635.c
@@ -1,4 +1,6 @@ 
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
 extern void d (void);
 
 void (*foo (void)) (float)
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43791.c b/gcc/testsuite/gcc.c-torture/compile/pr43791.c
index 2b1d06ff789..710bf7e9ec9 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr43791.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr43791.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 int owner();
 int clear();
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43845.c b/gcc/testsuite/gcc.c-torture/compile/pr43845.c
index bdb45e7d2a8..83442decd1c 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr43845.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr43845.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void);
 
 typedef struct {
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44043.c b/gcc/testsuite/gcc.c-torture/compile/pr44043.c
index 943501b4091..bd51089a70a 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr44043.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44043.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef unsigned char __u8;
 typedef unsigned short __u16;
 typedef unsigned int __u32;
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51694.c b/gcc/testsuite/gcc.c-torture/compile/pr51694.c
index f5c1a40df86..c06bc2118aa 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr51694.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr51694.c
@@ -1,4 +1,6 @@ 
 /* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
 void
 foo (x, fn)
   void (*fn) ();
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr77754-2.c b/gcc/testsuite/gcc.c-torture/compile/pr77754-2.c
index d088961963d..d649d719722 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr77754-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr77754-2.c
@@ -1,4 +1,5 @@ 
 // { dg-require-effective-target alloca }
+// { dg-require-effective-target indirect_calls }
 /* PR c/77754 */
 
 int fn3();
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr77754-3.c b/gcc/testsuite/gcc.c-torture/compile/pr77754-3.c
index fb25e234fe2..51d7ca71966 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr77754-3.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr77754-3.c
@@ -1,4 +1,5 @@ 
 // { dg-require-effective-target alloca }
+// { dg-require-effective-target indirect_calls }
 /* PR c/77754 */
 
 int fn3();
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr77754-4.c b/gcc/testsuite/gcc.c-torture/compile/pr77754-4.c
index 1c5c4619a33..53216bb6e7c 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr77754-4.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr77754-4.c
@@ -1,4 +1,5 @@ 
 // { dg-require-effective-target alloca }
+// { dg-require-effective-target indirect_calls }
 /* PR c/77754 */
 
 int fn3();
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c b/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c
index 052fe69f40e..efac68233f6 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr89663-2.c
@@ -1,4 +1,5 @@ 
 /* PR middle-end/89663 */
+/* { dg-require-effective-target indirect_calls } */
 
 int irint (double);
 long lrint (double);
diff --git a/gcc/testsuite/gcc.c-torture/compile/pta-1.c b/gcc/testsuite/gcc.c-torture/compile/pta-1.c
index 515e5ff13f4..07dad8a16a7 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pta-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pta-1.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target indirect_calls } */
+
 typedef struct JSObject JSObject;
 typedef struct JSObjectMap *(*JSNewObjectMapOp) (JSObject *obj);
 typedef JSObject *(*JSGetMethodOp) (JSObject *obj);
diff --git a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c
index 2a03f7c29ae..c06f5a19b01 100644
--- a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c
@@ -1,3 +1,4 @@ 
+/* { dg-require-effective-target indirect_calls } */
 /* { dg-require-effective-target untyped_assembly } */
 /* { dg-require-stack-check "" } */
 /* { dg-additional-options "-fstack-check" } */
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-18.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-18.c
index b4aa167f655..7888cb1b1da 100644
--- a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-18.c
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-18.c
@@ -4,6 +4,7 @@ 
    with zero or excessive size trigger either -Walloc-zero or
    -Walloc-size-larger-than warnings.
    { dg-do compile }
+   { dg-require-effective-target indirect_calls }
    { dg-options "-O2 -Wall -Walloc-zero -ftrack-macro-expansion=0" } */
 
 #define ATTR(...) __attribute__ ((__VA_ARGS__))
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 300d22a2d65..f457a46a02b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9552,3 +9552,11 @@  proc check_effective_target_mfentry { } {
 	        void foo (void) { }
     } "-mfentry"]
 }
+
+# Return 1 if this target supports indirect calls
+proc check_effective_target_indirect_calls { } {
+  if { [istarget bpf-*-*] } {
+        return 0
+  }
+  return 1
+}