This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH V2 6/8] bpf: adjust GCC testsuite to eBPF limitations


On 8/16/19 6:50 PM, Jose E. Marchesi wrote:
> This patch makes many tests in gcc.dg and gcc.c-torture to be skipped
> in bpf-*-* targets.  This is due to the many limitations imposed by
> eBPF to what would be perfectly valid C code: no support for indirect
> calls, no support for more than 5 arguments to function calls, no
> support for indirect jumps, a very limited range for direct jumps, the
> stack limit, lack of standard header files, etc.
> 
> Hopefully some of these restrictions will be relaxed in the future.
> In particular, I expect the stack limit will be significantly
> increased at some point.  Also, as semantics associated with object
> linking get developed in eBPF, it may be possible at some point to
> provide a set of standard run-time libraries for eBPF programs.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/builtins-config.h: eBPF doesn't support C99 standard
> 	functions.
> 	* gcc.c-torture/compile/20000211-1.c: Skip if target bpf-*-*.
> 	* gcc.c-torture/compile/20000403-1.c: Likewise.
> 	* gcc.c-torture/compile/20000609-1.c: Likewise.
> 	* gcc.c-torture/compile/20000804-1.c: Likewise.
> 	* gcc.c-torture/compile/20001226-1.c: Likewise.
> 	* gcc.c-torture/compile/20010102-1.c: Likewise.
> 	* 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/20020304-1.c: Likewise.
> 	* gcc.c-torture/compile/20020320-1.c: Likewise.
> 	* gcc.c-torture/compile/20020604-1.c: Likewise.
> 	* gcc.c-torture/compile/20020706-1.c: Likewise.
> 	* gcc.c-torture/compile/20020706-2.c: Likewise.
> 	* gcc.c-torture/compile/20021015-1.c: Likewise.
> 	* gcc.c-torture/compile/20021205-1.c: Likewise.
> 	* gcc.c-torture/compile/20030903-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/20031125-1.c: Likewise.
> 	* gcc.c-torture/compile/20040101-1.c: Likewise.
> 	* gcc.c-torture/compile/20040317-2.c: Likewise.
> 	* gcc.c-torture/compile/20040614-1.c: Likewise.
> 	* gcc.c-torture/compile/20040726-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/20050303-1.c: Likewise.
> 	* gcc.c-torture/compile/20050622-1.c: Likewise.
> 	* gcc.c-torture/compile/20051216-1.c: Likewise.
> 	* gcc.c-torture/compile/20060208-1.c: Likewise.
> 	* gcc.c-torture/compile/20060421-1.c: Likewise.
> 	* gcc.c-torture/compile/20071207-1.c: Likewise.
> 	* gcc.c-torture/compile/20080903-1.c: Likewise.
> 	* gcc.c-torture/compile/20081108-1.c: Likewise.
> 	* gcc.c-torture/compile/20101217-1.c: Likewise.
> 	* gcc.c-torture/compile/20121027-1.c: Likewise.
> 	* gcc.c-torture/compile/20150327.c: Likewise.
> 	* gcc.c-torture/compile/20151204.c: Likewise.
> 	* gcc.c-torture/compile/900313-1.c: Likewise.
> 	* gcc.c-torture/compile/920428-2.c: Likewise.
> 	* gcc.c-torture/compile/920501-12.c: Likewise.
> 	* gcc.c-torture/compile/920501-4.c: Likewise.
> 	* gcc.c-torture/compile/920501-7.c: Likewise.
> 	* gcc.c-torture/compile/920625-1.c: Likewise.
> 	* gcc.c-torture/compile/920723-1.c: Likewise.
> 	* gcc.c-torture/compile/920928-5.c: Likewise.
> 	* gcc.c-torture/compile/921202-1.c: Likewise.
> 	* gcc.c-torture/compile/930117-1.c: Likewise.
> 	* gcc.c-torture/compile/930421-1.c: Likewise.
> 	* gcc.c-torture/compile/930607-1.c: Likewise.
> 	* gcc.c-torture/compile/930623-1.c: Likewise.
> 	* gcc.c-torture/compile/931003-1.c: Likewise.
> 	* gcc.c-torture/compile/931004-1.c: Likewise.
> 	* gcc.c-torture/compile/950719-1.c: Likewise.
> 	* gcc.c-torture/compile/951222-1.c: Likewise.
> 	* gcc.c-torture/compile/961004-1.c: Likewise.
> 	* gcc.c-torture/compile/980504-1.c: Likewise.
> 	* gcc.c-torture/compile/980816-1.c: Likewise.
> 	* gcc.c-torture/compile/990517-1.c: Likewise.
> 	* gcc.c-torture/compile/990625-1.c: Likewise.
> 	* gcc.c-torture/compile/991213-2.c: Likewise.
> 	* gcc.c-torture/compile/DFcmp.c: Likewise.
> 	* gcc.c-torture/compile/HIcmp.c: Likewise.
> 	* gcc.c-torture/compile/HIset.c: Likewise.
> 	* gcc.c-torture/compile/QIcmp.c: Likewise.
> 	* gcc.c-torture/compile/QIset.c: Likewise.
> 	* gcc.c-torture/compile/SFset.c: Likewise.
> 	* gcc.c-torture/compile/SIcmp.c: Likewise.
> 	* gcc.c-torture/compile/SIset.c: Likewise.
> 	* gcc.c-torture/compile/UHIcmp.c: Likewise.
> 	* gcc.c-torture/compile/UQIcmp.c: Likewise.
> 	* gcc.c-torture/compile/USIcmp.c: Likewise.
> 	* gcc.c-torture/compile/bcopy.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/consec.c: Likewise.
> 	* gcc.c-torture/compile/limits-fndefn.c: Likewise.
> 	* gcc.c-torture/compile/lll.c: Likewise.
> 	* gcc.c-torture/compile/parms.c: Likewise.
> 	* gcc.c-torture/compile/pass.c: Likewise.
> 	* gcc.c-torture/compile/poor.c: Likewise.
> 	* gcc.c-torture/compile/pp.c: Likewise.
> 	* gcc.c-torture/compile/pr21840.c: Likewise.
> 	* gcc.c-torture/compile/pr23929.c: Likewise.
> 	* gcc.c-torture/compile/pr25310.c: Likewise.
> 	* gcc.c-torture/compile/pr25311.c: Likewise.
> 	* gcc.c-torture/compile/pr32139.c: Likewise.
> 	* gcc.c-torture/compile/pr32399.c: Likewise.
> 	* gcc.c-torture/compile/pr34091.c: Likewise.
> 	* gcc.c-torture/compile/pr34458.c: Likewise.
> 	* gcc.c-torture/compile/pr34688.c: Likewise.
> 	* gcc.c-torture/compile/pr35607.c: Likewise.
> 	* gcc.c-torture/compile/pr37258.c: Likewise.
> 	* gcc.c-torture/compile/pr37327.c: Likewise.
> 	* gcc.c-torture/compile/pr37381.c: Likewise.
> 	* gcc.c-torture/compile/pr37433-1.c: Likewise.
> 	* gcc.c-torture/compile/pr37433.c: Likewise.
> 	* gcc.c-torture/compile/pr37669-2.c: Likewise.
> 	* gcc.c-torture/compile/pr37669.c: Likewise.
> 	* gcc.c-torture/compile/pr37742-3.c: Likewise.
> 	* gcc.c-torture/compile/pr39937.c: Likewise.
> 	* gcc.c-torture/compile/pr39941.c: Likewise.
> 	* gcc.c-torture/compile/pr40080.c: Likewise.
> 	* gcc.c-torture/compile/pr41181.c: Likewise.
> 	* gcc.c-torture/compile/pr41634.c: Likewise.
> 	* gcc.c-torture/compile/pr43415.c: Likewise.
> 	* gcc.c-torture/compile/pr43417.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/pr44063.c: Likewise.
> 	* gcc.c-torture/compile/pr44788.c: Likewise.
> 	* gcc.c-torture/compile/pr48596.c: Likewise.
> 	* gcc.c-torture/compile/pr51694.c: Likewise.
> 	* gcc.c-torture/compile/pr51856.c: Likewise.
> 	* gcc.c-torture/compile/pr52750.c: Likewise.
> 	* gcc.c-torture/compile/pr54713-1.c: Likewise.
> 	* gcc.c-torture/compile/pr54713-2.c: Likewise.
> 	* gcc.c-torture/compile/pr54713-3.c: Likewise.
> 	* gcc.c-torture/compile/pr55921.c: Likewise.
> 	* gcc.c-torture/compile/pr70240.c: Likewise.
> 	* gcc.c-torture/compile/pr70355.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/pr82052.c: Likewise.
> 	* gcc.c-torture/compile/pr83487.c: Likewise.
> 	* gcc.c-torture/compile/pr86122.c: Likewise.
> 	* gcc.c-torture/compile/pr89280.c: Likewise.
> 	* gcc.c-torture/compile/pr89663-2.c: Likewise.
> 	* gcc.c-torture/compile/pret-arg.c: Likewise.
> 	* gcc.c-torture/compile/pta-1.c: Likewise.
> 	* gcc.c-torture/compile/regs-arg-size.c: Likewise.
> 	* gcc.c-torture/compile/sound.c: Likewise.
> 	* gcc.c-torture/compile/stack-check-1.c: Likewise.
> 	* gcc.c-torture/compile/structret.c: Likewise.
> 	* gcc.c-torture/compile/uuarg.c: Likewise.
> 	* gcc.dg/20001009-1.c: Likewise.
> 	* gcc.dg/20020418-1.c: Likewise.
> 	* gcc.dg/20020426-2.c: Likewise.
> 	* gcc.dg/20020430-1.c: Likewise.
> 	* gcc.dg/20040306-1.c: Likewise.
> 	* gcc.dg/20040622-2.c: Likewise.
> 	* gcc.dg/20050603-2.c: Likewise.
> 	* gcc.dg/20050629-1.c: Likewise.
> 	* gcc.dg/20061026.c: Likewise.
> 	* gcc.dg/Walloc-size-larger-than-18.c: Likewise.
> 	* gcc.dg/Warray-bounds-3.c: Likewise.
> 	* gcc.dg/Warray-bounds-30.c: Likewise.
> 	* gcc.dg/Wframe-larger-than-2.c: Likewise.
> 	* gcc.dg/Wframe-larger-than.c: Likewise.
> 	* gcc.dg/Wrestrict-11.c: Likewise.
So I think we probably want an effective target check for indirect calls
rather than checking explicitly for ebpf in all these files.

It also seems like rather than checking for ebpf on files with large
stacks, we should be using the generic mechanisms to defined the allowed
size of the stack (mentioned in prior review) & mark test which use too
much space.  This would almost certainly help other embedded targets as
well.

Not sure the best way to deal with too many arguments.  I suspect we
want an efffective target check for that.  Keeping this up-to-date will
be painful as people write more tests.




  /* Copyright (C) 2000, 2003 Free Software Foundation */
>  __complex__ long long f ()
> diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
> index be0bdcf7631..9f6bd0af2e5 100644
> --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
> +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
> @@ -3,6 +3,7 @@
>  /* { dg-skip-if "too much code for pdp11" { "pdp11-*-*" } } */
>  /* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */
>  /* { dg-skip-if "" { m32c-*-* } } */
> +/* { dg-skip-if "jumps too far for eBPF" { bpf-*-* } } */
>  /* { dg-timeout-factor 4.0 } */
Jumps too far is probably an indication you need to fix something in
your port.  Though I guess its OK if you're never going to support far
away targets.



>  
> diff --git a/gcc/testsuite/gcc.c-torture/compile/20101217-1.c b/gcc/testsuite/gcc.c-torture/compile/20101217-1.c
> index c4eef0ed464..cd902afe709 100644
> --- a/gcc/testsuite/gcc.c-torture/compile/20101217-1.c
> +++ b/gcc/testsuite/gcc.c-torture/compile/20101217-1.c
> @@ -1,3 +1,5 @@
> +/* { dg-skip-if "no usable stdio.h for eBPF" { bpf-*-* } } */
I think this is only to get the printf prototype.  I suspect you could
just provide a suitable prototype and drop the #include <stdio.h>.


Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]