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.
From-SVN: r275505
+2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * doc/sourcebuild.texi (Effective-Target Keywords): Document
+ indirect_calls.
+
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* opt-functions.awk (integer_range_info): Make sure values are in
@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}
+2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * 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.
+
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* gcc.c-torture/compile/20000609-1.c: Annotate with
Copyright (C) 2001 Free Software Foundation. */
+/* { dg-require-effective-target indirect_calls } */
+
# define PTR_INT_TYPE __PTRDIFF_TYPE__
struct _obstack_chunk
+/* { dg-require-effective-target indirect_calls } */
+
unsigned long x[4];
void foo(void)
+/* { dg-require-effective-target indirect_calls } */
+
typedef struct { short x[4]; } S;
typedef struct { unsigned int a, b, c; S *d; } T;
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);
/* 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 *);
/* Test call to static variable. */
+/* { dg-require-effective-target indirect_calls } */
+
typedef struct
{
long long a[10];
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[];
// Contributed by Alexandre Oliva <aoliva@redhat.com>
// From Red Hat case 106165.
+/* { dg-require-effective-target indirect_calls } */
+
typedef struct s1
{
unsigned short v1;
// 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)
+/* { dg-require-effective-target indirect_calls } */
+
typedef struct x x;
extern void *baz(char *);
struct x { char * (*bar) (int); };
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();}
/* 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
/* 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"
/* 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"
+/* { dg-require-effective-target indirect_calls } */
+
#define ASIZE 0x80000000UL
#include "20031023-1.c"
/* { dg-require-effective-target label_values } */
+/* { dg-require-effective-target indirect_calls } */
void f(int r1, int *fp)
{
+/* { dg-require-effective-target indirect_calls } */
+
static __inline__ int
one_utf8_to_utf16 () { }
/* From PR 19484. */
+/* { dg-require-effective-target indirect_calls } */
+
extern void foo (void) __attribute__((noreturn));
int n;
/* From PR 19578. */
+/* { dg-require-effective-target indirect_calls } */
+
extern void foo (void) __attribute__((noreturn));
void
/* 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);
+/* { dg-require-effective-target indirect_calls } */
+
/* Test function call with function designator involving VLA
side-effects does not lead to an ICE. */
+/* { dg-require-effective-target indirect_calls } */
+
int a;
int (*b)(), (*c)();
int fn1(int p1) {
+/* { dg-require-effective-target indirect_calls } */
+
double sin(double x);
double cos(double x);
double tan(double x);
/* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */
+
+/* { dg-require-effective-target indirect_calls } */
+
struct b{};
f(struct b(*f)())
{
+/* { dg-require-effective-target indirect_calls } */
+
f(x)
{
(*(void (*)())&x)();
+/* { dg-require-effective-target indirect_calls } */
+
typedef void f ();
typedef f *pf;
long long i;
+/* { dg-require-effective-target indirect_calls } */
+
typedef long __kernel_time_t;
typedef __kernel_time_t time_t;
time2(
+/* { dg-require-effective-target indirect_calls } */
+
bar (foo, a)
int (**foo) ();
{
/* { dg-require-effective-target ptr32plus } */
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
typedef void (*T)(void);
f1 ()
/* { dg-require-effective-target ptr32plus } */
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
typedef void *(*T)(void);
f1 ()
+/* { dg-require-effective-target indirect_calls } */
+
void fn_show_state(void);
typedef void (*fn_handler_fn)(void);
static fn_handler_fn fn_handler[1];
/* PR tree-optimization/32139 */
+/* { dg-require-effective-target indirect_calls } */
+
int foo (void);
int bar (void) __attribute__ ((const));
+/* { dg-require-effective-target indirect_calls } */
+
extern void (*__fini_array_start []) (void);
extern void (*__fini_array_end []) (void);
void
+/* { dg-require-effective-target indirect_calls } */
+
void regex_subst(void)
{
const void *subst = "";
+/* { dg-require-effective-target indirect_calls } */
+
int regex_subst(void)
{
const void *subst = "";
+/* { dg-require-effective-target indirect_calls } */
+
typedef void (*entry_func) (void) __attribute__ ((noreturn));
extern entry_func entry_addr;
static void bsd_boot_entry (void)
+/* { dg-require-effective-target indirect_calls } */
+
extern void *ff(void*,int);
struct lpgl { struct lpgl *next; };
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
extern void d (void);
void (*foo (void)) (float)
+/* { dg-require-effective-target indirect_calls } */
+
int owner();
int clear();
+/* { dg-require-effective-target indirect_calls } */
+
typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void);
typedef struct {
+/* { dg-require-effective-target indirect_calls } */
+
typedef unsigned char __u8;
typedef unsigned short __u16;
typedef unsigned int __u32;
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-effective-target indirect_calls } */
+
void
foo (x, fn)
void (*fn) ();
// { dg-require-effective-target alloca }
+// { dg-require-effective-target indirect_calls }
/* PR c/77754 */
int fn3();
// { dg-require-effective-target alloca }
+// { dg-require-effective-target indirect_calls }
/* PR c/77754 */
int fn3();
// { dg-require-effective-target alloca }
+// { dg-require-effective-target indirect_calls }
/* PR c/77754 */
int fn3();
/* PR middle-end/89663 */
+/* { dg-require-effective-target indirect_calls } */
int irint (double);
long lrint (double);
+/* { dg-require-effective-target indirect_calls } */
+
typedef struct JSObject JSObject;
typedef struct JSObjectMap *(*JSNewObjectMapOp) (JSObject *obj);
typedef JSObject *(*JSGetMethodOp) (JSObject *obj);
+/* { dg-require-effective-target indirect_calls } */
/* { dg-require-effective-target untyped_assembly } */
/* { dg-require-stack-check "" } */
/* { dg-additional-options "-fstack-check" } */
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__))
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
+}