linux_dsm_epyc7002/tools/testing/selftests/bpf/progs
Ilya Leoshkevich 4ce150b6a4 selftests/bpf: add bpf-gcc support
Now that binutils and gcc support for BPF is upstream, make use of it in
BPF selftests using alu32-like approach. Share as much as possible of
CFLAGS calculation with clang.

Fixes only obvious issues, leaving more complex ones for later:
- Use gcc-provided bpf-helpers.h instead of manually defining the
  helpers, change bpf_helpers.h include guard to avoid conflict.
- Include <linux/stddef.h> for __always_inline.
- Add $(OUTPUT)/../usr/include to include path in order to use local
  kernel headers instead of system kernel headers when building with O=.

In order to activate the bpf-gcc support, one needs to configure
binutils and gcc with --target=bpf and make them available in $PATH. In
particular, gcc must be installed as `bpf-gcc`, which is the default.

Right now with binutils 25a2915e8dba and gcc r275589 only a handful of
tests work:

	# ./test_progs_bpf_gcc
	# Summary: 7/39 PASSED, 1 SKIPPED, 98 FAILED

The reason for those failures are as follows:

- Build errors:
  - `error: too many function arguments for eBPF` for __always_inline
    functions read_str_var and read_map_var - must be inlining issue,
    and for process_l3_headers_v6, which relies on optimizing away
    function arguments.
  - `error: indirect call in function, which are not supported by eBPF`
    where there are no obvious indirect calls in the source calls, e.g.
    in __encap_ipip_none.
  - `error: field 'lock' has incomplete type` for fields of `struct
    bpf_spin_lock` type - bpf_spin_lock is re#defined by bpf-helpers.h,
    so its usage is sensitive to order of #includes.
  - `error: eBPF stack limit exceeded` in sysctl_tcp_mem.
- Load errors:
  - Missing object files due to above build errors.
  - `libbpf: failed to create map (name: 'test_ver.bss')`.
  - `libbpf: object file doesn't contain bpf program`.
  - `libbpf: Program '.text' contains unrecognized relo data pointing to
    section 0`.
  - `libbpf: BTF is required, but is missing or corrupted` - no BTF
    support in gcc yet.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Jose E. Marchesi <jose.marchesi@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-09-16 09:32:00 +02:00
..
bpf_flow.c selftests/bpf: fix race in flow dissector tests 2019-08-13 16:31:10 +02:00
btf__core_reloc_arrays___diff_arr_dim.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays___diff_arr_val_sz.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays___err_non_array.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays___err_too_shallow.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays___err_too_small.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays___err_wrong_val_type1.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays___err_wrong_val_type2.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_arrays.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_flavors__err_wrong_name.c selftests/bpf: add CO-RE relocs struct flavors tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_flavors.c selftests/bpf: add CO-RE relocs struct flavors tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___bool.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___err_bitfield.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___err_wrong_sz_8.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___err_wrong_sz_16.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___err_wrong_sz_32.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___err_wrong_sz_64.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints___reverse_sign.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ints.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_misc.c selftests/bpf: add CO-RE relocs misc tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_mods___mod_swap.c selftests/bpf: add CO-RE relocs modifiers/typedef tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_mods___typedefs.c selftests/bpf: add CO-RE relocs modifiers/typedef tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_mods.c selftests/bpf: add CO-RE relocs modifiers/typedef tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___anon_embed.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___dup_compat_types.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_array_container.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_array_field.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_dup_incompat_types.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_missing_container.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_missing_field.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_nonstruct_container.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_partial_match_dups.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___err_too_deep.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___extra_nesting.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting___struct_union_mixup.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_nesting.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives___diff_enum_def.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives___diff_func_proto.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives___diff_ptr_type.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives___err_non_enum.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives___err_non_int.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives___err_non_ptr.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_primitives.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ptr_as_arr___diff_sz.c selftests/bpf: add CO-RE relocs ptr-as-array tests 2019-08-07 14:43:49 -07:00
btf__core_reloc_ptr_as_arr.c selftests/bpf: add CO-RE relocs ptr-as-array tests 2019-08-07 14:43:49 -07:00
btf_dump_test_case_bitfields.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
btf_dump_test_case_multidim.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
btf_dump_test_case_namespacing.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
btf_dump_test_case_ordering.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
btf_dump_test_case_packing.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
btf_dump_test_case_padding.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
btf_dump_test_case_syntax.c selftests/bpf: add btf_dump BTF-to-C conversion tests 2019-05-24 14:05:58 -07:00
connect4_prog.c
connect6_prog.c
core_reloc_types.h tools/bpf: fix core_reloc.c compilation error 2019-08-07 18:24:03 -07:00
dev_cgroup.c
get_cgroup_id_kern.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
loop1.c selftests/bpf: fix compiling loop{1, 2, 3}.c on s390 2019-07-12 15:38:23 +02:00
loop2.c selftests/bpf: fix compiling loop{1, 2, 3}.c on s390 2019-07-12 15:38:23 +02:00
loop3.c selftests/bpf: fix compiling loop{1, 2, 3}.c on s390 2019-07-12 15:38:23 +02:00
loop4.c selftests/bpf: add loop test 4 2019-08-06 08:20:25 -07:00
loop5.c selftests/bpf: add loop test 5 2019-08-06 08:20:31 -07:00
netcnt_prog.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
pyperf50.c selftests/bpf: add pyperf scale test 2019-05-23 16:20:57 +02:00
pyperf100.c selftests/bpf: add pyperf scale test 2019-05-23 16:20:57 +02:00
pyperf180.c selftests/bpf: add pyperf scale test 2019-05-23 16:20:57 +02:00
pyperf600_nounroll.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
pyperf600.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
pyperf.h selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
sample_map_ret0.c
sample_ret0.c
sendmsg4_prog.c
sendmsg6_prog.c selftests/bpf: fix sendmsg6_prog on s390 2019-07-22 16:19:06 +02:00
socket_cookie_prog.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
sockmap_parse_prog.c selftests/bpf: remove bpf_util.h from BPF C progs 2019-06-11 10:36:02 +02:00
sockmap_tcp_msg_prog.c selftests/bpf: remove bpf_util.h from BPF C progs 2019-06-11 10:36:02 +02:00
sockmap_verdict_prog.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
sockopt_inherit.c selftests/bpf: add sockopt clone/inheritance test 2019-08-17 23:18:54 +02:00
sockopt_multi.c selftests/bpf: add sockopt test that exercises BPF_F_ALLOW_MULTI 2019-06-27 15:25:17 -07:00
sockopt_sk.c selftests/bpf: extend sockopt_sk selftest with TCP_CONGESTION use case 2019-08-01 13:55:52 -07:00
strobemeta_nounroll1.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
strobemeta_nounroll2.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
strobemeta.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
strobemeta.h selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
tcp_rtt.c selftests/bpf: test BPF_SOCK_OPS_RTT_CB 2019-07-03 16:52:02 +02:00
test_adjust_tail.c
test_attach_probe.c selftests/bpf: fix test_attach_probe map definition 2019-07-08 16:25:58 +02:00
test_btf_haskv.c
test_btf_newkv.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_btf_nokv.c
test_core_reloc_arrays.c selftests/bpf: add CO-RE relocs array tests 2019-08-07 14:43:49 -07:00
test_core_reloc_flavors.c selftests/bpf: add CO-RE relocs struct flavors tests 2019-08-07 14:43:49 -07:00
test_core_reloc_ints.c selftests/bpf: add CO-RE relocs ints tests 2019-08-07 14:43:49 -07:00
test_core_reloc_kernel.c selftests/bpf: add CO-RE relocs testing setup 2019-08-07 14:43:49 -07:00
test_core_reloc_misc.c selftests/bpf: add CO-RE relocs misc tests 2019-08-07 14:43:49 -07:00
test_core_reloc_mods.c selftests/bpf: add CO-RE relocs modifiers/typedef tests 2019-08-07 14:43:49 -07:00
test_core_reloc_nesting.c selftests/bpf: add CO-RE relocs nesting tests 2019-08-07 14:43:49 -07:00
test_core_reloc_primitives.c selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests 2019-08-07 14:43:49 -07:00
test_core_reloc_ptr_as_arr.c selftests/bpf: add CO-RE relocs ptr-as-array tests 2019-08-07 14:43:49 -07:00
test_get_stack_rawtp.c selftests/bpf: convert test_get_stack_raw_tp to perf_buffer API 2019-07-23 16:05:42 -07:00
test_global_data.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_jhash.h selftests: bpf: standardize to static __always_inline 2019-07-03 15:06:33 +02:00
test_l4lb_noinline.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_l4lb.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_lirc_mode2_kern.c
test_lwt_ip_encap.c
test_lwt_seg6local.c selftests/bpf: introduce bpf_cpu_to_be64 and bpf_be64_to_cpu 2019-09-03 21:01:52 +02:00
test_map_in_map.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
test_map_lock.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_obj_id.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
test_perf_buffer.c selftests/bpf: test perf buffer API 2019-07-08 15:35:43 +02:00
test_pkt_access.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
test_pkt_md_access.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
test_queue_map.c
test_seg6_loop.c selftests/bpf: introduce bpf_cpu_to_be64 and bpf_be64_to_cpu 2019-09-03 21:01:52 +02:00
test_select_reuseport_kern.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_send_signal_kern.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_sk_lookup_kern.c
test_skb_cgroup_id_kern.c
test_skb_ctx.c selftests: bpf: add selftest for __sk_buff context in BPF_PROG_TEST_RUN 2019-04-11 10:21:41 +02:00
test_sock_fields_kern.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_sockhash_kern.c
test_sockmap_kern.c
test_spin_lock.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_stack_map.c
test_stacktrace_build_id.c selftests/bpf: use typedef'ed arrays as map values 2019-07-15 23:02:17 +02:00
test_stacktrace_map.c selftests/bpf: use typedef'ed arrays as map values 2019-07-15 23:02:17 +02:00
test_sysctl_loop1.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
test_sysctl_loop2.c selftests/bpf: add realistic loop tests 2019-06-19 02:22:52 +02:00
test_sysctl_prog.c selftests/bpf: remove bpf_util.h from BPF C progs 2019-06-11 10:36:02 +02:00
test_tc_edt.c selftests/bpf: add bpf-gcc support 2019-09-16 09:32:00 +02:00
test_tc_tunnel.c selftests/bpf: expand test_tc_tunnel with SIT encap 2019-04-24 01:32:26 +02:00
test_tcp_check_syncookie_kern.c selftests/bpf: add test for bpf_tcp_gen_syncookie 2019-07-30 21:03:05 -07:00
test_tcp_estats.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_tcpbpf_kern.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_tcpnotify_kern.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
test_tracepoint.c
test_tunnel_kern.c
test_verif_scale1.c selftests/bpf: add few verifier scale tests 2019-04-04 01:27:38 +02:00
test_verif_scale2.c selftests: bpf: standardize to static __always_inline 2019-07-03 15:06:33 +02:00
test_verif_scale3.c selftests/bpf: add few verifier scale tests 2019-04-04 01:27:38 +02:00
test_xdp_loop.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
test_xdp_meta.c
test_xdp_noinline.c selftests/bpf: fix test_xdp_noinline on s390 2019-07-18 13:54:54 -07:00
test_xdp_redirect.c
test_xdp_vlan.c
test_xdp.c selftests/bpf: convert selftests using BTF-defined maps to new syntax 2019-07-05 22:52:25 +02:00
xdp_dummy.c
xdp_redirect_map.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00
xdp_tx.c selftests, bpf: Add test for veth native XDP 2019-06-24 18:18:30 -07:00
xdping_kern.c selftests/bpf: convert legacy BPF maps to BTF-defined ones 2019-07-05 22:52:25 +02:00