From: Jose E. Marchesi Date: Thu, 6 Aug 2020 12:13:59 +0000 (+0200) Subject: bpf: more flexible support for kernel helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af30b83b50953fbbe671d93d44ea6ac2f7a50ce9;p=gcc.git bpf: more flexible support for kernel helpers This patch changes the existing support for BPF kernel helpers to be more flexible, in two main ways. First, there is no longer a hardcoded list of kernel helpers defined in the compiler internals. This is replaced by a new target-specific attribute `kernel_helper' that the user can use to define her own helpers, annotating function prototypes. Second, following feedback from the kernel hackers, the pre-defined helpers in the distributed bpf-helpers.h are no longer available conditionally depending on the kernel version used in -mkernel. The command-line option stays for now, as it may be useful for other things. Target tests and documentation updated. 2020-08-06 Jose E. Marchesi gcc/ * config/bpf/bpf-helpers.h (KERNEL_HELPER): Define. (KERNEL_VERSION): Remove. * config/bpf/bpf-helpers.def: Delete. * config/bpf/bpf.c (bpf_handle_fndecl_attribute): New function. (bpf_attribute_table): Define. (bpf_helper_names): Delete. (bpf_helper_code): Likewise. (enum bpf_builtins): Adjust to new helpers mechanism. (bpf_output_call): Likewise. (bpf_init_builtins): Likewise. (bpf_init_builtins): Likewise. * doc/extend.texi (BPF Function Attributes): New section. (BPF Kernel Helpers): Delete section. gcc/testsuite/ * gcc.target/bpf/helper-bind.c: Adjust to new kernel helpers mechanism. * gcc.target/bpf/helper-bpf-redirect.c: Likewise. * gcc.target/bpf/helper-clone-redirect.c: Likewise. * gcc.target/bpf/helper-csum-diff.c: Likewise. * gcc.target/bpf/helper-csum-update.c: Likewise. * gcc.target/bpf/helper-current-task-under-cgroup.c: Likewise. * gcc.target/bpf/helper-fib-lookup.c: Likewise. * gcc.target/bpf/helper-get-cgroup-classid.c: Likewise. * gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise. * gcc.target/bpf/helper-get-current-comm.c: Likewise. * gcc.target/bpf/helper-get-current-pid-tgid.c: Likewise. * gcc.target/bpf/helper-get-current-task.c: Likewise. * gcc.target/bpf/helper-get-current-uid-gid.c: Likewise. * gcc.target/bpf/helper-get-hash-recalc.c: Likewise. * gcc.target/bpf/helper-get-listener-sock.c: Likewise. * gcc.target/bpf/helper-get-local-storage.c: Likewise. * gcc.target/bpf/helper-get-numa-node-id.c: Likewise. * gcc.target/bpf/helper-get-prandom-u32.c: Likewise. * gcc.target/bpf/helper-get-route-realm.c: Likewise. * gcc.target/bpf/helper-get-smp-processor-id.c: Likewise. * gcc.target/bpf/helper-get-socket-cookie.c: Likewise. * gcc.target/bpf/helper-get-socket-uid.c: Likewise. * gcc.target/bpf/helper-get-stack.c: Likewise. * gcc.target/bpf/helper-get-stackid.c: Likewise. * gcc.target/bpf/helper-getsockopt.c: Likewise. * gcc.target/bpf/helper-ktime-get-ns.c: Likewise. * gcc.target/bpf/helper-l3-csum-replace.c: Likewise. * gcc.target/bpf/helper-l4-csum-replace.c: Likewise. * gcc.target/bpf/helper-lwt-push-encap.c: Likewise. * gcc.target/bpf/helper-lwt-seg6-action.c: Likewise. * gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise. * gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise. * gcc.target/bpf/helper-map-delete-elem.c: Likewise. * gcc.target/bpf/helper-map-lookup-elem.c: Likewise. * gcc.target/bpf/helper-map-peek-elem.c: Likewise. * gcc.target/bpf/helper-map-pop-elem.c: Likewise. * gcc.target/bpf/helper-map-push-elem.c: Likewise. * gcc.target/bpf/helper-map-update-elem.c: Likewise. * gcc.target/bpf/helper-msg-apply-bytes.c: Likewise. * gcc.target/bpf/helper-msg-cork-bytes.c: Likewise. * gcc.target/bpf/helper-msg-pop-data.c: Likewise. * gcc.target/bpf/helper-msg-pull-data.c: Likewise. * gcc.target/bpf/helper-msg-push-data.c: Likewise. * gcc.target/bpf/helper-msg-redirect-hash.c: Likewise. * gcc.target/bpf/helper-msg-redirect-map.c: Likewise. * gcc.target/bpf/helper-override-return.c: Likewise. * gcc.target/bpf/helper-perf-event-output.c: Likewise. * gcc.target/bpf/helper-perf-event-read-value.c: Likewise. * gcc.target/bpf/helper-perf-event-read.c: Likewise. * gcc.target/bpf/helper-perf-prog-read-value.c: Likewise. * gcc.target/bpf/helper-probe-read-str.c: Likewise. * gcc.target/bpf/helper-probe-read.c: Likewise. * gcc.target/bpf/helper-probe-write-user.c: Likewise. * gcc.target/bpf/helper-rc-keydown.c: Likewise. * gcc.target/bpf/helper-rc-pointer-rel.c: Likewise. * gcc.target/bpf/helper-rc-repeat.c: Likewise. * gcc.target/bpf/helper-redirect-map.c: Likewise. * gcc.target/bpf/helper-set-hash-invalid.c: Likewise. * gcc.target/bpf/helper-set-hash.c: Likewise. * gcc.target/bpf/helper-setsockopt.c: Likewise. * gcc.target/bpf/helper-sk-fullsock.c: Likewise. * gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise. * gcc.target/bpf/helper-sk-lookup-upd.c: Likewise. * gcc.target/bpf/helper-sk-redirect-hash.c: Likewise. * gcc.target/bpf/helper-sk-redirect-map.c: Likewise. * gcc.target/bpf/helper-sk-release.c: Likewise. * gcc.target/bpf/helper-sk-select-reuseport.c: Likewise. * gcc.target/bpf/helper-sk-storage-delete.c: Likewise. * gcc.target/bpf/helper-sk-storage-get.c: Likewise. * gcc.target/bpf/helper-skb-adjust-room.c: Likewise. * gcc.target/bpf/helper-skb-cgroup-id.c: Likewise. * gcc.target/bpf/helper-skb-change-head.c: Likewise. * gcc.target/bpf/helper-skb-change-proto.c: Likewise. * gcc.target/bpf/helper-skb-change-tail.c: Likewise. * gcc.target/bpf/helper-skb-change-type.c: Likewise. * gcc.target/bpf/helper-skb-ecn-set-ce.c: Likewise. * gcc.target/bpf/helper-skb-get-tunnel-key.c: Likewise. * gcc.target/bpf/helper-skb-get-tunnel-opt.c: Likewise. * gcc.target/bpf/helper-skb-get-xfrm-state.c: Likewise. * gcc.target/bpf/helper-skb-load-bytes-relative.c: Likewise. * gcc.target/bpf/helper-skb-load-bytes.c: Likewise. * gcc.target/bpf/helper-skb-pull-data.c: Likewise. * gcc.target/bpf/helper-skb-set-tunnel-key.c: Likewise. * gcc.target/bpf/helper-skb-set-tunnel-opt.c: Likewise. * gcc.target/bpf/helper-skb-store-bytes.c: Likewise. * gcc.target/bpf/helper-skb-under-cgroup.c: Likewise. * gcc.target/bpf/helper-skb-vlan-pop.c: Likewise. * gcc.target/bpf/helper-skb-vlan-push.c: Likewise. * gcc.target/bpf/helper-skc-lookup-tcp.c: Likewise. * gcc.target/bpf/helper-sock-hash-update.c: Likewise. * gcc.target/bpf/helper-sock-map-update.c: Likewise. * gcc.target/bpf/helper-sock-ops-cb-flags-set.c: Likewise. * gcc.target/bpf/helper-spin-lock.c: Likewise. * gcc.target/bpf/helper-spin-unlock.c: Likewise. * gcc.target/bpf/helper-strtol.c: Likewise. * gcc.target/bpf/helper-strtoul.c: Likewise. * gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise. * gcc.target/bpf/helper-sysctl-get-name.c: Likewise. * gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise. * gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise. * gcc.target/bpf/helper-tail-call.c: Likewise. * gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise. * gcc.target/bpf/helper-tcp-sock.c: Likewise. * gcc.target/bpf/helper-trace-printk.c: Likewise. * gcc.target/bpf/helper-xdp-adjust-head.c: Likewise. * gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise. * gcc.target/bpf/helper-xdp-adjust-tail.c: Likewise. * gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise. --- diff --git a/gcc/config/bpf/bpf-helpers.def b/gcc/config/bpf/bpf-helpers.def deleted file mode 100644 index 249ad248a48..00000000000 --- a/gcc/config/bpf/bpf-helpers.def +++ /dev/null @@ -1,194 +0,0 @@ -/* Kernel helpers database. - Copyright (C) 2019-2020 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -/* This file contains the definition of the kernel helpers that are - available to eBPF programs. - - The primary source for information on kernel helpers is the - linux/include/uapi/linux/bpf.h file in the Linux source tree. - Please keep this database in sync. - - The first column is the first kernel version featuring the helper - function. This should be an enumerate from bpf_kernel_version, - defined in bpf-opts.h. Note that the backend assumes that helpers - never get deprecated in the kernel. If that eventually happens, - then we will need to use a bitmask here instead of an enumerate. - - The second column is the constant-name for the helper. - The third column is the program-name of the helper. - - The fourth column is a list of names describing the types of the - values returned and accepted by the helper, in one of these forms: - - TYPES (type1, type2, ..., 0) - VTYPES (type1, type2, ..., 0) - - VTYPES should be used should the helper accept a variable number of - arguments, TYPES otherwise. The valid type names are: - - `vt' for void. - `it' for signed int. - `ut' for unsigned int. - `pt' for void*. - `cpt' for const void*. - `st' for short int. - `ust' for unsigned short int. - `cst' for const char *. - `ullt' for unsigned long long. - `llt' for long long. - `u32t' for uint32. - `u64t' for uint64. - - In types descriptions, the firt entry corresponds to the value - returned by the helper. Subsequent names correspond to the helper - arguments. Finally, a 0 should close the list. - - VERY IMPORTANT: the helper entries should be listed in the same - order than in the definition of __BPF_FUNC_MAPPER in - linux/include/uapi/linux/bpf.h! */ - -DEF_HELPER (LINUX_V4_0, MAP_LOOKUP_ELEM, map_lookup_elem, TYPES (pt, pt, pt, 0)) -DEF_HELPER (LINUX_V4_0, MAP_UPDATE_ELEM, map_update_elem, TYPES (it, pt, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V4_0, MAP_DELETE_ELEM, map_delete_elem, TYPES (it, pt, pt, 0)) -DEF_HELPER (LINUX_V4_1, PROBE_READ, probe_read, TYPES (it, pt, ut, cpt, 0)) -DEF_HELPER (LINUX_V4_1, KTIME_GET_NS, ktime_get_ns, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_1, TRACE_PRINTK, trace_printk, VTYPES (it, cst, it, 0)) -DEF_HELPER (LINUX_V4_1, GET_PRANDOM_U32, get_prandom_u32, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_1, GET_SMP_PROCESSOR_ID, get_smp_processor_id, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_1, SKB_STORE_BYTES, skb_store_bytes, TYPES (it, pt, it, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_1, L3_CSUM_REPLACE, l3_csum_replace, TYPES (it, pt, it, it ,it ,it, 0)) -DEF_HELPER (LINUX_V4_1, L4_CSUM_REPLACE, l4_csum_replace, TYPES (it, pt, it, it, it, it, 0)) -DEF_HELPER (LINUX_V4_2, TAIL_CALL, tail_call, TYPES (vt, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_2, CLONE_REDIRECT, clone_redirect, TYPES (it, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_2, GET_CURRENT_PID_TGID, get_current_pid_tgid, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_2, GET_CURRENT_UID_GID, get_current_uid_gid, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_2, GET_CURRENT_COMM, get_current_comm, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_3, GET_CGROUP_CLASSID, get_cgroup_classid, TYPES (it, pt, 0)) -DEF_HELPER (LINUX_V4_3, SKB_VLAN_PUSH, skb_vlan_push, TYPES (it, pt, st, ust, 0)) -DEF_HELPER (LINUX_V4_3, SKB_VLAN_POP, skb_vlan_pop, TYPES (it, pt, 0)) -DEF_HELPER (LINUX_V4_3, SKB_GET_TUNNEL_KEY, skb_get_tunnel_key, TYPES (it, pt, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_3, SKB_SET_TUNNEL_KEY, skb_set_tunnel_key, TYPES (it, pt, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_3, PERF_EVENT_READ, perf_event_read, TYPES (ullt, pt, ullt, 0)) -DEF_HELPER (LINUX_V4_4, REDIRECT, redirect, TYPES (it, it, it, 0)) -DEF_HELPER (LINUX_V4_4, GET_ROUTE_REALM, get_route_realm, TYPES (ut, pt, 0)) -DEF_HELPER (LINUX_V4_4, PERF_EVENT_OUTPUT, perf_event_output, \ - TYPES (it, pt, pt, ullt, pt, it, 0)) -DEF_HELPER (LINUX_V4_5, SKB_LOAD_BYTES, skb_load_bytes, TYPES (it, pt, it, pt, it, 0)) -DEF_HELPER (LINUX_V4_6, GET_STACKID, get_stackid, TYPES (it, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_6, CSUM_DIFF, csum_diff, TYPES (it, pt, it, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_6, SKB_GET_TUNNEL_OPT, skb_get_tunnel_opt, TYPES (it, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_6, SKB_SET_TUNNEL_OPT, skb_set_tunnel_opt, TYPES (it, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_8, SKB_CHANGE_PROTO, skb_change_proto, TYPES (it, pt, st, u64t, 0)) -DEF_HELPER (LINUX_V4_8, SKB_CHANGE_TYPE, skb_change_type, TYPES (it, pt, u32t, 0)) -DEF_HELPER (LINUX_V4_8, SKB_UNDER_CGROUP, skb_under_cgroup, TYPES (it, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_8, GET_HASH_RECALC, get_hash_recalc, TYPES (ut, pt, 0)) -DEF_HELPER (LINUX_V4_8, GET_CURRENT_TASK, get_current_task, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_8, PROBE_WRITE_USER, probe_write_user, TYPES (it, pt, cpt, ut, 0)) -DEF_HELPER (LINUX_V4_9, CURRENT_TASK_UNDER_CGROUP, current_task_under_cgroup, \ - TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_9, SKB_CHANGE_TAIL, skb_change_tail, TYPES (it, pt, ut, u64t, 0)) -DEF_HELPER (LINUX_V4_9, SKB_PULL_DATA, skb_pull_data, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_9, CSUM_UPDATE, csum_update, TYPES (llt, pt, u32t, 0)) -DEF_HELPER (LINUX_V4_9, SET_HASH_INVALID, set_hash_invalid, TYPES (vt, pt, 0)) -DEF_HELPER (LINUX_V4_10, GET_NUMA_NODE_ID, get_numa_node_id, TYPES (it, 0)) -DEF_HELPER (LINUX_V4_10, SKB_CHANGE_HEAD, skb_change_head, TYPES (it, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_10, XDP_ADJUST_HEAD, xdp_adjust_head, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_11, PROBE_READ_STR, probe_read_str, TYPES (it, pt, u32t, cpt, 0)) -DEF_HELPER (LINUX_V4_12, GET_SOCKET_COOKIE, get_socket_cookie, TYPES (it, pt, 0)) -DEF_HELPER (LINUX_V4_12, GET_SOCKET_UID, get_socket_uid, TYPES (ut, pt, 0)) -DEF_HELPER (LINUX_V4_13, SET_HASH, set_hash, TYPES (ut, pt, u32t, 0)) -DEF_HELPER (LINUX_V4_13, SETSOCKOPT, setsockopt, TYPES (it, pt, it, it, pt, it, 0)) -DEF_HELPER (LINUX_V4_13, SKB_ADJUST_ROOM, skb_adjust_room, TYPES (it, pt, st, u32t, ullt, 0)) -DEF_HELPER (LINUX_V4_14, REDIRECT_MAP, redirect_map, TYPES (it, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_14, SK_REDIRECT_MAP, sk_redirect_map, TYPES (it, pt, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_14, SOCK_MAP_UPDATE, sock_map_update, TYPES (it, pt, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V4_15, XDP_ADJUST_META, xdp_adjust_meta, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_15, PERF_EVENT_READ_VALUE, perf_event_read_value, - TYPES (it, pt, ullt, pt, ut, 0)) -DEF_HELPER (LINUX_V4_15, PERF_PROG_READ_VALUE, perf_prog_read_value, - TYPES (it, pt, pt, ut, 0)) -DEF_HELPER (LINUX_V4_15, GETSOCKOPT, getsockopt, TYPES (it, pt, it, it, pt, it, 0)) - -DEF_HELPER (LINUX_V4_16, OVERRIDE_RETURN, override_return, TYPES (it, pt, ult, 0)) -DEF_HELPER (LINUX_V4_16, SOCK_OPS_CB_FLAGS_SET, sock_ops_cb_flags_set, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_17, MSG_REDIRECT_MAP, msg_redirect_map, TYPES (it, pt, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_17, MSG_APPLY_BYTES, msg_apply_bytes, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_17, MSG_CORK_BYTES, msg_cork_bytes, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_17, MSG_PULL_DATA, msg_pull_data, TYPES (it, pt, it, it, it, 0)) -DEF_HELPER (LINUX_V4_17, BIND, bind, TYPES (it, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_18, XDP_ADJUST_TAIL, xdp_adjust_tail, TYPES (it, pt, it, 0)) -DEF_HELPER (LINUX_V4_18, SKB_GET_XFRM_STATE, - skb_get_xfrm_state, TYPES (it, pt, it, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_18, GET_STACK, get_stack, TYPES (it, pt, pt, it, it, 0)) -DEF_HELPER (LINUX_V4_18, SKB_LOAD_BYTES_RELATIVE, skb_load_bytes_relative, - TYPES (it, pt, it, pt, it, ut, 0)) -DEF_HELPER (LINUX_V4_18, FIB_LOOKUP, fib_lookup, TYPES (it, pt, pt, it, ut, 0)) -DEF_HELPER (LINUX_V4_18, SOCK_HASH_UPDATE, sock_hash_update, TYPES (it, pt, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V4_18, MSG_REDIRECT_HASH, msg_redirect_hash, TYPES (it, pt, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_18, SK_REDIRECT_HASH, sk_redirect_hash, TYPES (it, pt, pt, pt, it, 0)) -DEF_HELPER (LINUX_V4_18, LWT_PUSH_ENCAP, lwt_push_encap, TYPES (it, pt, ut, pt, ut, 0)) -DEF_HELPER (LINUX_V4_18, LWT_SEG6_STORE_BYTES, lwt_seg6_store_bytes, - TYPES (it, pt, ut, pt, ut, 0)) -DEF_HELPER (LINUX_V4_18, LWT_SEG6_ADJUST_SRH, lwt_seg6_adjust_srh, TYPES (it, pt, ut, ut, 0)) -DEF_HELPER (LINUX_V4_18, LWT_SEG6_ACTION, lwt_seg6_action, TYPES (it, pt, ut, pt, ut, 0)) -DEF_HELPER (LINUX_V4_18, RC_REPEAT, rc_repeat, TYPES (it, pt, 0)) -DEF_HELPER (LINUX_V4_18, RC_KEYDOWN, rc_keydown, TYPES (it, pt, ut, ullt, ut, 0)) -DEF_HELPER (LINUX_V4_18, SKB_CGROUP_ID, skb_cgroup_id, TYPES (ullt, pt, 0)) -DEF_HELPER (LINUX_V4_18, GET_CURRENT_CGROUP_ID, get_current_cgroup_id, TYPES (ullt, 0)) -DEF_HELPER (LINUX_V4_19, GET_LOCAL_STORAGE, get_local_storage, TYPES (pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V4_19, SK_SELECT_REUSEPORT, sk_select_reuseport, - TYPES (it, pt, pt, pt, ut, 0)) -DEF_HELPER (LINUX_V4_19, SKB_ANCESTOR_CGROUP_ID, skb_ancestor_cgroup_id, - TYPES (ullt, pt, it, 0)) -DEF_HELPER (LINUX_V4_20, SK_LOOKUP_TCP, sk_lookup_tcp, TYPES (pt, pt, pt, it, ullt, ullt, 0)) -DEF_HELPER (LINUX_V4_20, SK_LOOKUP_UDP, sk_lookup_udp, TYPES (pt, pt, pt, it, ullt, ullt, 0)) -DEF_HELPER (LINUX_V4_20, SK_RELEASE, sk_release, TYPES (it, pt, 0)) -DEF_HELPER (LINUX_V4_20, MAP_PUSH_ELEM, map_push_elem, TYPES (it, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V4_20, MAP_POP_ELEM, map_pop_elem, TYPES (it, pt, pt, 0)) -DEF_HELPER (LINUX_V4_20, MAP_PEEK_ELEM, map_peek_elem, TYPES (it, pt, pt, 0)) -DEF_HELPER (LINUX_V4_20, MSG_PUSH_DATA, msg_push_data, TYPES (it, pt, it, it, it, 0)) -DEF_HELPER (LINUX_V5_0, MSG_POP_DATA, msg_pop_data, TYPES (it, pt, it, it, it, 0)) -DEF_HELPER (LINUX_V5_0, RC_POINTER_REL, rc_pointer_rel, TYPES (it, pt, it, it, 0)) -DEF_HELPER (LINUX_V5_1, SPIN_LOCK, spin_lock, TYPES (vt, pt, 0)) -DEF_HELPER (LINUX_V5_1, SPIN_UNLOCK, spin_unlock, TYPES (vt, pt, 0)) -DEF_HELPER (LINUX_V5_1, SK_FULLSOCK, sk_fullsock, TYPES (pt, pt, 0)) -DEF_HELPER (LINUX_V5_1, TCP_SOCK, tcp_sock, TYPES (pt, pt, 0)) -DEF_HELPER (LINUX_V5_1, SKB_ECN_SET_CE, skb_ecn_set_ce, TYPES (it, pt, 0)) -DEF_HELPER (LINUX_V5_1, GET_LISTENER_SOCK, get_listener_sock, TYPES (pt, pt, 0)) -DEF_HELPER (LINUX_V5_2, SKC_LOOKUP_TCP, skc_lookup_tcp, - TYPES (pt, pt, pt, u32t, u64t, u64t, 0)) -DEF_HELPER (LINUX_V5_2, TCP_CHECK_SYNCOOKIE, tcp_check_syncookie, - TYPES (it, pt, pt, u32t, pt, u32t, 0)) -DEF_HELPER (LINUX_V5_2, SYSCTL_GET_NAME, sysctl_get_name, TYPES (it, pt, pt, ullt, u64t, 0)) -DEF_HELPER (LINUX_V5_2, SYSCTL_GET_CURRENT_VALUE, sysctl_get_current_value, - TYPES (it, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V5_2, SYSCTL_GET_NEW_VALUE, sysctl_get_new_value, - TYPES (it, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V5_2, SYSCTL_SET_NEW_VALUE, sysctl_set_new_value, - TYPES (it, pt, pt, ullt, 0)) -DEF_HELPER (LINUX_V5_2, STRTOL, strtol, TYPES (it, cst, ullt, u64t, pt, 0)) -DEF_HELPER (LINUX_V5_2, STRTOUL, strtoul, TYPES (it, pt, ullt, u64t, pt, 0)) -DEF_HELPER (LINUX_V5_2, SK_STORAGE_GET, sk_storage_get, TYPES (pt, pt, pt, pt, u64t, 0)) -DEF_HELPER (LINUX_V5_2, SK_STORAGE_DELETE, sk_storage_delete, TYPES (it, pt, pt, 0)) - -/* -Local variables: -mode:c -End: -*/ diff --git a/gcc/config/bpf/bpf-helpers.h b/gcc/config/bpf/bpf-helpers.h index 1dd05c8ef69..a615321c622 100644 --- a/gcc/config/bpf/bpf-helpers.h +++ b/gcc/config/bpf/bpf-helpers.h @@ -30,6 +30,7 @@ #define __BPF_HELPERS_H #define SEC(NAME) __attribute__((section(NAME), used)) +#define KERNEL_HELPER(NUM) __attribute__((kernel_helper(NUM))) /* Flags used in some kernel helpers. */ @@ -41,277 +42,376 @@ #define BPF_F_NO_COMMON_LRU (1U << 1) #define BPF_F_NUMA_NODE (1U << 2) -/* Functions to call kernel helpers. We provide the "standard" bpf_* - names as synonyms of the corresponding GCC builtins. In some - cases, where non-void pointers are passed to the helper, inline - functions are used to achieve proper type checking. */ +/* Prototypes of functions to call kernel helpers. + Please keep these protoypes sorted by helper number. */ -#ifndef KERNEL_VERSION -# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#endif +void *bpf_map_lookup_elem (void *map, const void *key) + KERNEL_HELPER (1); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,0,0) +int bpf_map_update_elem (void *map, const void *key, const void *value, + unsigned long long flags) + KERNEL_HELPER (2); -#define bpf_map_lookup_elem __builtin_bpf_helper_map_lookup_elem -#define bpf_map_update_elem __builtin_bpf_helper_map_update_elem -#define bpf_map_delete_elem __builtin_bpf_helper_map_delete_elem +int bpf_map_delete_elem (void *map, const void *key) + KERNEL_HELPER (3); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,1,0) +int bpf_probe_read (void *dst, int size, const void *unsafe_ptr) + KERNEL_HELPER (4); -#define bpf_probe_read __builtin_bpf_helper_probe_read -#define bpf_ktime_get_ns __builtin_bpf_helper_ktime_get_ns -#define bpf_trace_printk __builtin_bpf_helper_trace_printk -#define bpf_get_prandom_u32 __builtin_bpf_helper_get_prandom_u32 -#define bpf_get_smp_processor_id __builtin_bpf_helper_get_smp_processor_id -#define bpf_skb_store_bytes __builtin_bpf_helper_skb_store_bytes -#define bpf_l3_csum_replace __builtin_bpf_helper_l3_csum_replace -#define bpf_l4_csum_replace __builtin_bpf_helper_l4_csum_replace +unsigned long long bpf_ktime_get_ns (void) + KERNEL_HELPER (5); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,2,0) +int bpf_trace_printk (const char *fmt, int fmt_size, ...) + KERNEL_HELPER (6); -#define bpf_tail_call __builtin_bpf_helper_tail_call -#define bpf_clone_redirect __builtin_bpf_helper_clone_redirect -#define bpf_get_current_pid_tgid __builtin_bpf_helper_get_current_pid_tgid -#define bpf_get_current_uid_gid __builtin_bpf_helper_get_current_uid_gid -#define bpf_get_current_comm __builtin_bpf_helper_get_current_comm +unsigned long long bpf_get_prandom_u32 (void) + KERNEL_HELPER (7); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,3,0) +unsigned long long bpf_get_smp_processor_id (void) + KERNEL_HELPER (8); -#define bpf_get_cgroup_classid __builtin_bpf_helper_get_cgroup_classid -#define bpf_skb_vlan_push __builtin_bpf_helper_skb_vlan_push -#define bpf_skb_vlan_pop __builtin_bpf_helper_skb_vlan_pop -#define bpf_skb_get_tunnel_key __builtin_bpf_helper_skb_get_tunnel_key -#define bpf_skb_set_tunnel_key __builtin_bpf_helper_skb_set_tunnel_key -#define bpf_perf_event_read __builtin_bpf_helper_perf_event_read +int bpf_skb_store_bytes (void *ctx, int off, void *from, int len, + unsigned int start_header) + KERNEL_HELPER (9); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,4,0) +int bpf_l3_csum_replace (void *ctx, int off, int from, int to, int flags) + KERNEL_HELPER (10); -#define bpf_redirect __builtin_bpf_helper_redirect -#define bpf_get_route_realm __builtin_bpf_helper_get_route_realm -#define bpf_perf_event_output __builtin_bpf_helper_perf_event_output +int bpf_l4_csum_replace (void *ctx, int off, int from, int to, int flags) + KERNEL_HELPER (11); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,5,0) +int bpf_tail_call (void *ctx, void *map, unsigned int index) + KERNEL_HELPER (12); -#define bpf_skb_load_bytes __builtin_bpf_helper_skb_load_bytes +int bpf_clone_redirect (void *ctx, int ifindex, int flags) + KERNEL_HELPER (13); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,6,0) +unsigned long long bpf_get_current_pid_tgid (void) + KERNEL_HELPER (14); -#define bpf_get_stackid __builtin_bpf_helper_get_stackid -#define bpf_csum_diff __builtin_bpf_helper_csum_diff -#define bpf_skb_get_tunnel_opt __builtin_bpf_helper_skb_get_tunnel_opt -#define bpf_skb_set_tunnel_opt __builtin_bpf_helper_skb_set_tunnel_opt +unsigned long long bpf_get_current_uid_gid (void) + KERNEL_HELPER (15); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,8,0) +int bpf_get_current_comm (void *buf, int buf_size) + KERNEL_HELPER (16); -#define bpf_skb_change_proto __builtin_bpf_helper_skb_change_proto -#define bpf_skb_change_type __builtin_bpf_helper_skb_change_type -#define bpf_skb_under_cgroup __builtin_bpf_helper_skb_under_cgroup -#define bpf_get_hash_recalc __builtin_bpf_helper_get_hash_recalc -#define bpf_get_current_task __builtin_bpf_helper_get_current_task -#define bpf_probe_write_user __builtin_bpf_helper_probe_write_user +unsigned int bpf_get_cgroup_classid (void *ctx) + KERNEL_HELPER (17); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,9,0) +int bpf_skb_vlan_push (void *ctx, short vlan_proto, + unsigned short vlan_tci) + KERNEL_HELPER (18); -#define bpf_current_task_under_cgroup __builtin_bpf_helper_current_task_under_cgroup -#define bpf_skb_change_tail __builtin_bpf_helper_skb_change_tail -#define bpf_skb_pull_data __builtin_bpf_helper_skb_pull_data -#define bpf_csum_update __builtin_bpf_helper_csum_update -#define bpf_set_hash_invalid __builtin_bpf_helper_set_hash_invalid +int bpf_skb_vlan_pop (void *ctx) + KERNEL_HELPER (19); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,10,0) +int bpf_skb_get_tunnel_key (void *ctx, void *key, int size, int flags) + KERNEL_HELPER (20); -#define bpf_get_numa_node_id __builtin_bpf_helper_get_numa_node_id -#define bpf_skb_change_head __builtin_bpf_helper_skb_change_head -#define bpf_xdp_adjust_head __builtin_bpf_helper_xdp_adjust_head +int bpf_skb_set_tunnel_key (void *ctx, void *key, int size, int flags) + KERNEL_HELPER (21); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,11,0) +unsigned long long bpf_perf_event_read (void *map, unsigned long long flags) + KERNEL_HELPER (22); -#define bpf_probe_read_str __builtin_bpf_helper_probe_read_str +int bpf_redirect (int ifindex, int flags) + KERNEL_HELPER (23); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,12,0) +unsigned int bpf_get_route_realm (void *ctx) + KERNEL_HELPER (24); -#define bpf_get_socket_cookie __builtin_bpf_helper_get_socket_cookie -#define bpf_get_socket_uid __builtin_bpf_helper_get_socket_uid +int bpf_perf_event_output (void *ctx, void *map, unsigned long long flags, + void *data, int size) + KERNEL_HELPER (25); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,13,0) +int bpf_skb_load_bytes (void *ctx, int off, void *to, int len) + KERNEL_HELPER (26); -#define bpf_set_hash __builtin_bpf_helper_set_hash -#define bpf_setsockopt __builtin_bpf_helper_setsockopt -#define bpf_skb_adjust_room __builtin_bpf_helper_skb_adjust_room +int bpf_get_stackid (void *ctx, void *map, int flags) + KERNEL_HELPER (27); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,14,0) +int bpf_csum_diff (void *from, int from_size, void *to, int to_size, int seed) + KERNEL_HELPER (28); -#define bpf_redirect_map __builtin_bpf_helper_redirect_map -#define bpf_sk_redirect_map __builtin_bpf_helper_sk_redirect_map -#define bpf_sock_map_update __builtin_bpf_helper_sock_map_update +int bpf_skb_get_tunnel_opt (void *ctx, void *md, int size) + KERNEL_HELPER (29); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,15,0) +int bpf_skb_set_tunnel_opt (void *ctx, void *md, int size) + KERNEL_HELPER (30); -#define bpf_perf_event_read_value __builtin_bpf_helper_perf_event_read_value -#define bpf_perf_prog_read_value __builtin_bpf_helper_perf_prog_read_value -#define bpf_getsockopt __builtin_bpf_helper_getsockopt -#define bpf_xdp_adjust_meta __builtin_bpf_helper_xdp_adjust_meta +int bpf_skb_change_proto (void *ctx, short proto, unsigned long flags) + KERNEL_HELPER (31); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,16,0) +int bpf_skb_change_type (void *ctx, unsigned int type) + KERNEL_HELPER (32); -#define bpf_override_return __builtin_bpf_helper_override_return -#define bpf_sock_ops_cb_flags_set __builtin_bpf_helper_sock_ops_cb_flags_set +int bpf_skb_under_cgroup (void *ctx, void *map, int index) + KERNEL_HELPER (33); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,17,0) +unsigned int bpf_get_hash_recalc (void *ctx) + KERNEL_HELPER (34); -#define bpf_msg_redirect_map __builtin_bpf_helper_msg_redirect_map -#define bpf_msg_apply_bytes __builtin_bpf_helper_msg_apply_bytes -#define bpf_msg_cork_bytes __builtin_bpf_helper_msg_cork_bytes -#define bpf_pull_data __builtin_bpf_helper_pull_data -#define bpf_bind __builtin_bpf_helper_bpf_bind +unsigned long long bpf_get_current_task (void) + KERNEL_HELPER (35); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,18,0) +int bpf_probe_write_user (void *dst, const void *src, int size) + KERNEL_HELPER (36); -#define bpf_xdp_adjust_tail __builtin_bpf_helper_xdp_adjust_tail -#define bpf_skb_get_xfrm_state __builtin_bpf_helper_skb_get_xfrm_state -#define bpf_get_stack __builtin_bpf_helper_get_stack -#define bpf_skb_load_bytes_relative __builtin_bpf_helper_skb_load_bytes_relative -#define bpf_sock_hash_update __builtin_bpf_helper_sock_hash_update -#define bpf_msg_redirect_hash __builtin_bpf_helper_msg_redirect_hash -#define bpf_sk_redirect_hash __builtin_bpf_helper_sk_redirect_hash -#define bpf_lwt_push_encap __builtin_bpf_helper_lwt_push_encap -#define bpf_lwt_seg6_store_bytes __builtin_bpf_helper_lwt_seg6_store_bytes -#define bpf_lwt_seg6_adjust_srh __builtin_bpf_helper_lwt_seg6_adjust_srh -#define bpf_lwt_seg6_action __builtin_bpf_helper_lwt_seg6_action -#define bpf_rc_repeat __builtin_bpf_helper_rc_repeat -#define bpf_rc_keydown __builtin_bpf_helper_rc_keydown -#define bpf_skb_cgroup_id __builtin_bpf_helper_skb_cgroup_id -#define bpf_get_current_cgroup_id __builtin_bpf_helper_get_current_cgroup_id +int bpf_current_task_under_cgroup (void *map, int index) + KERNEL_HELPER (37); -static inline int -bpf_fib_lookup (void *ctx, struct bpf_fib_lookup *param, int plen, - unsigned int flags) -{ - return __builtin_bpf_helper_fib_lookup (ctx, (void *) param, plen, flags); -} +int bpf_skb_change_tail (void *ctx, unsigned int len, unsigned long flags) + KERNEL_HELPER (38); +int bpf_skb_pull_data (void *, int len) + KERNEL_HELPER (39); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,19,0) +long long bpf_csum_update (void *ctx, unsigned int csum) + KERNEL_HELPER (40); -#define bpf_get_local_storage __builtin_bpf_helper_get_local_storage -#define bpf_sk_select_reuseport __builtin_bpf_helper_sk_select_reuseport -#define bpf_skb_ancestor_cgroup_id __builtin_bpf_helper_skb_ancestor_cgroup_id +void bpf_set_hash_invalid (void *ctx) + KERNEL_HELPER (41); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (4,20,0) +int bpf_get_numa_node_id (void) + KERNEL_HELPER (42); -#define bpf_sk_release __builtin_bpf_helper_sk_release -#define bpf_map_push_elem __builtin_bpf_helper_map_push_elem -#define bpf_map_pop_elem __builtin_bpf_helper_map_pop_elem -#define bpf_map_peek_elem __builtin_bpf_helper_map_peek_elem -#define bpf_msg_push_data __builtin_bpf_helper_msg_push_data +int bpf_skb_change_head (void *, int len, int flags) + KERNEL_HELPER (43); -static inline struct bpf_sock * -bpf_sk_lookup_tcp (void *ctx, struct bpf_sock_tuple *tuple, - int size, unsigned long long netns_id, - unsigned long long flags) -{ - return - (struct bpf_sock *) __builtin_bpf_helper_sk_lookup_tcp (ctx, - (void *) tuple, - size, - netns_id, flags); -} - -static inline struct bpf_sock * -bpf_sk_lookup_udp (void *ctx, struct bpf_sock_tuple *tuple, - int size, unsigned long long netns_id, - unsigned long long flags) -{ - return - (struct bpf_sock *) __builtin_bpf_helper_sk_lookup_udp (ctx, - (void *) tuple, - size, - netns_id, flags); -} +int bpf_xdp_adjust_head (void *ctx, int offset) + KERNEL_HELPER (44); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (5,0,0) +int bpf_probe_read_str (void *ctx, unsigned int size, const void *unsafe_ptr) + KERNEL_HELPER (45); -#define bpf_msg_pop_data __builtin_bpf_helper_pop_data -#define bpf_rc_pointer_rel __builtin_bpf_helper_rc_pointer_rel +int bpf_get_socket_cookie (void *ctx) + KERNEL_HELPER (46); -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (5,1,0) +unsigned int bpf_get_socket_uid (void *ctx) + KERNEL_HELPER (47); -#define bpf_spin_lock __builtin_bpf_helper_spin_lock -#define bpf_spin_unlock __builtin_bpf_helper_spin_unlock -#define bpf_skb_ecn_set_ce __builtin_bpf_helper_skb_ecn_set_ce +unsigned int bpf_set_hash (void *ctx, unsigned int hash) + KERNEL_HELPER (48); -static inline struct bpf_sock * -bpf_sk_fullsock (struct bpf_sock *sk) -{ - return - (struct bpf_sock *) __builtin_bpf_helper_sk_fullsock ((void *) sk); -} +int bpf_setsockopt (void *ctx, int level, int optname, void *optval, int optlen) + KERNEL_HELPER (49); -static inline struct bpf_sock * -bpf_tcp_sock (struct bpf_sock *sk) -{ - return - (struct bpf_sock *) __builtin_bpf_helper_tcp_sock ((void *) sk); -} +int bpf_skb_adjust_room (void *ctx, int len_diff, unsigned int mode, + unsigned long long flags) + KERNEL_HELPER (50); -static inline struct bpf_sock * -bpf_get_listener_sock (struct bpf_sock *sk) -{ - return - (struct bpf_sock *) __builtin_bpf_helper_get_listener_sock ((void *) sk); -} - -#if __BPF_KERNEL_VERSION_CODE__ >= KERNEL_VERSION (5,2,0) - - -#endif /* 5.2 */ -#endif /* 5.1 */ -#endif /* 5.0 */ -#endif /* 4.20 */ -#endif /* 4.19 */ -#endif /* 4.18 */ -#endif /* 4.17 */ -#endif /* 4.16 */ -#endif /* 4.15 */ -#endif /* 4.14 */ -#endif /* 4.13 */ -#endif /* 4.12 */ -#endif /* 4.11 */ -#endif /* 4.10 */ -#endif /* 4.9 */ -#endif /* 4.8 */ -#endif /* 4.6 */ -#endif /* 4.5 */ -#endif /* 4.4 */ -#endif /* 4.3 */ -#endif /* 4.2 */ -#endif /* 4.1 */ -#endif /* 4.0 */ +int bpf_redirect_map (void *map, int key, int flags) + KERNEL_HELPER (51); + +int bpf_sk_redirect_map (void *ctx, void *map, int key, int flags) + KERNEL_HELPER (52); + +int bpf_sock_map_update (void *map, void *key, void *value, + unsigned long long flags) + KERNEL_HELPER (53); + +int bpf_xdp_adjust_meta (void *ctx, int offset) + KERNEL_HELPER (54); + +int bpf_perf_event_read_value (void *map, unsigned long long flags, + void *buf, unsigned int buf_size) + KERNEL_HELPER (55); + +int bpf_perf_prog_read_value (void *ctx, void *buf, unsigned int buf_size) + KERNEL_HELPER (56); + +int bpf_getsockopt (void *ctx, int level, int optname, void *optval, + int optlen) + KERNEL_HELPER (57); + +int bpf_override_return (void *ctx, unsigned long rc) + KERNEL_HELPER (58); + +int bpf_sock_ops_cb_flags_set (void *ctx, int flags) + KERNEL_HELPER (59); + +int bpf_msg_redirect_map (void *ctx, void *map, int key, int flags) + KERNEL_HELPER (60); + +int bpf_msg_apply_bytes (void *ctx, int len) + KERNEL_HELPER (61); + +int bpf_msg_cork_bytes (void *ctx, int len) + KERNEL_HELPER (62); + +int bpf_msg_pull_data (void *, int len) + KERNEL_HELPER (63); + +int bpf_bind (void *ctx, void *addr, int addr_len) + KERNEL_HELPER (64); + +int bpf_xdp_adjust_tail (struct xdp_md *xdp_md, int delta) + KERNEL_HELPER (65); + +int bpf_skb_get_xfrm_state (void *ctx, int index, void *state, + int size, int flags) + KERNEL_HELPER (66); + +int bpf_get_stack (void *ctx, void *buf, int size, int flags) + KERNEL_HELPER (67); + +int bpf_skb_load_bytes_relative (void *ctx, int off, void *to, int len, + unsigned int start_header) + KERNEL_HELPER (68); + +int bpf_fib_lookup (void *ctx, struct bpf_fib_lookup *params, + int plen, unsigned int flags) + KERNEL_HELPER (69); + +int bpf_sock_hash_update (void *map, void *key, void *value, + unsigned long long flags) + KERNEL_HELPER (70); + +int bpf_msg_redirect_hash (void *ctx, void *map, void *key, int flags) + KERNEL_HELPER (71); + +int bpf_sk_redirect_hash (void *ctx, void *map, void *key, int flags) + KERNEL_HELPER (72); + +int bpf_lwt_push_encap (void *ctx, unsigned int type, void *hdr, + unsigned int len) + KERNEL_HELPER (73); + +int bpf_lwt_seg6_store_bytes (void *ctx, unsigned int offset, + void *from, unsigned int len) + KERNEL_HELPER (74); + +int bpf_lwt_seg6_adjust_srh (void *ctx, unsigned int offset, + unsigned int len) + KERNEL_HELPER (75); + +int bpf_lwt_seg6_action (void *ctx, unsigned int action, void *param, + unsigned int param_len) + KERNEL_HELPER (76); + +int bpf_rc_repeat (void *ctx) + KERNEL_HELPER (77); + +int bpf_rc_keydown (void *ctx, unsigned int protocol, + unsigned long long scancode, unsigned int toggle) + KERNEL_HELPER (78); + +unsigned bpf_skb_cgroup_id (void *ctx) + KERNEL_HELPER (79); + +unsigned long long bpf_get_current_cgroup_id (void) + KERNEL_HELPER (80); + +void *bpf_get_local_storage (void *map, unsigned long long flags) + KERNEL_HELPER (81); + +int bpf_sk_select_reuseport (void *ctx, void *map, void *key, unsigned int flags) + KERNEL_HELPER (82); + +unsigned long long bpf_skb_ancestor_cgroup_id (void *ctx, int level) + KERNEL_HELPER (83); + +struct bpf_sock *bpf_sk_lookup_tcp (void *ctx, struct bpf_sock_tuple *tuple, + int size, unsigned long long netns_id, + unsigned long long flags) + KERNEL_HELPER (84); + +struct bpf_sock *bpf_sk_lookup_udp (void *ctx, struct bpf_sock_tuple *tuple, + int size, unsigned long long netns_id, + unsigned long long flags) + KERNEL_HELPER (85); + +int bpf_sk_release (struct bpf_sock *sk) + KERNEL_HELPER (86); + +int bpf_map_push_elem (void *map, const void *value, unsigned long long flags) + KERNEL_HELPER (87); + +int bpf_map_pop_elem (void *map, void *value) + KERNEL_HELPER (88); + +int bpf_map_peek_elem (void *map, void *value) + KERNEL_HELPER (89); + +int bpf_msg_push_data (void *ctx, int start, int cut, int flags) + KERNEL_HELPER (90); + +int bpf_msg_pop_data (void *ctx, int start, int cut, int flags) + KERNEL_HELPER (91); + +int bpf_rc_pointer_rel (void *ctx, int rel_x, int rel_y) + KERNEL_HELPER (92); + +void bpf_spin_lock (struct bpf_spin_lock *lock) + KERNEL_HELPER (93); + +void bpf_spin_unlock (struct bpf_spin_lock *lock) + KERNEL_HELPER (94); + +struct bpf_sock *bpf_sk_fullsock (struct bpf_sock *sk) + KERNEL_HELPER (95); + +struct bpf_sock *bpf_tcp_sock (struct bpf_sock *sk) + KERNEL_HELPER (96); + +int bpf_skb_ecn_set_ce (void *ctx) + KERNEL_HELPER (97); + +struct bpf_sock *bpf_get_listener_sock (struct bpf_sock *sk) + KERNEL_HELPER (98); + +struct bpf_sock *bpf_skc_lookup_tcp (void *ctx, + struct bpf_sock_tuple *tuple, + unsigned int tuple_size, + unsigned long netns, + unsigned long flags) + KERNEL_HELPER (99); + +int bpf_tcp_check_syncookie (struct bpf_sock *sk, void *iph, + unsigned int iph_len, + struct tcp_hdr *th, + unsigned int th_len) + KERNEL_HELPER (100); + +int bpf_sysctl_get_name (struct bpf_sysctl *ctx, + char *buf, unsigned long buf_len, + unsigned long flags) + KERNEL_HELPER (101); + +int bpf_sysctl_get_current_value (struct bpf_sysctl *ctx, + char *buf, unsigned long buf_len) + KERNEL_HELPER (102); + +int bpf_sysctl_get_new_value (struct bpf_sysctl *ctx, char *buf, + unsigned long buf_len) + KERNEL_HELPER (103); + +int bpf_sysctl_set_new_value (struct bpf_sysctl *ctx, const char *buf, + unsigned long buf_len) + KERNEL_HELPER (104); + +int bpf_strtol (const char *buf, unsigned long buf_len, + unsigned long flags, long *res) + KERNEL_HELPER (105); + +int bpf_strtoul (const char *buf, unsigned long buf_len, + unsigned long flags, unsigned long *res) + KERNEL_HELPER (106); + +void *bpf_sk_storage_get (void *map, struct bpf_sock *sk, + void *value, long flags) + KERNEL_HELPER (107); + +int bpf_sk_storage_delete (void *map, struct bpf_sock *sk) + KERNEL_HELPER (108); /* Functions to emit BPF_LD_ABS and BPF_LD_IND instructions. We provide the "standard" names as synonyms of the corresponding GCC builtins. Note how the SKB argument is ignored. */ -static inline long long -load_byte (void *skb __attribute__ ((unused)), - unsigned long long off) -{ - return __builtin_bpf_load_byte (off); -} - -static inline long long -load_half (void *skb __attribute__ ((unused)), - unsigned long long off) -{ - return __builtin_bpf_load_half (off); -} - -static inline long long -load_word (void *skb __attribute__ ((unused)), - unsigned long long off) -{ - return __builtin_bpf_load_word (off); -} +#define load_byte(SKB,OFF) __builtin_bpf_load_byte ((OFF)) +#define load_half(SKB,OFF) __builtin_bpf_load_half ((OFF)) +#define load_word(SKB,OFF) __builtin_bpf_load_word ((OFF)) struct bpf_map_def { diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c index 36e08338630..84d17d4a27f 100644 --- a/gcc/config/bpf/bpf.c +++ b/gcc/config/bpf/bpf.c @@ -66,6 +66,63 @@ struct GTY(()) machine_function int callee_saved_reg_size; }; +/* Handle an attribute requiring a FUNCTION_DECL; + arguments as in struct attribute_spec.handler. */ + +static tree +bpf_handle_fndecl_attribute (tree *node, tree name, + tree args, + int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) +{ + if (TREE_CODE (*node) != FUNCTION_DECL) + { + warning (OPT_Wattributes, "%qE attribute only applies to functions", + name); + *no_add_attrs = true; + } + + if (is_attribute_p ("kernel_helper", name)) + { + if (args) + { + tree cst = TREE_VALUE (args); + if (TREE_CODE (cst) != INTEGER_CST) + { + warning (OPT_Wattributes, "%qE attribute requires an integer argument", + name); + *no_add_attrs = true; + } + } + else + { + warning (OPT_Wattributes, "%qE requires an argument", name); + *no_add_attrs = true; + } + } + + return NULL_TREE; +} + +/* Target-specific attributes. */ + +static const struct attribute_spec bpf_attribute_table[] = +{ + /* Syntax: { name, min_len, max_len, decl_required, type_required, + function_type_required, affects_type_identity, handler, + exclude } */ + + /* Attribute to mark function prototypes as kernel helpers. */ + { "kernel_helper", 1, 1, true, false, false, false, + bpf_handle_fndecl_attribute, NULL }, + + /* The last attribute spec is set to be NULL. */ + { NULL, 0, 0, false, false, false, false, NULL, NULL } +}; + +#undef TARGET_ATTRIBUTE_TABLE +#define TARGET_ATTRIBUTE_TABLE bpf_attribute_table + /* Data structures for the eBPF specific built-ins. */ /* Maximum number of arguments taken by a builtin function, plus @@ -75,47 +132,13 @@ struct GTY(()) machine_function enum bpf_builtins { BPF_BUILTIN_UNUSED = 0, - /* Built-ins for kernel helpers. */ -#define DEF_HELPER(V,D,N,T) BPF_BUILTIN_HELPER_##D, -# include "bpf-helpers.def" -#undef DEF_HELPER - BPF_BUILTIN_HELPER_MAX, /* Built-ins for non-generic loads and stores. */ - BPF_BUILTIN_LOAD_BYTE = BPF_BUILTIN_HELPER_MAX, + BPF_BUILTIN_LOAD_BYTE, BPF_BUILTIN_LOAD_HALF, BPF_BUILTIN_LOAD_WORD, BPF_BUILTIN_MAX, }; -/* This table is indexed by an enum bpf_builtin. */ -static const char *bpf_helper_names[] = -{ - NULL, -#define DEF_HELPER(V,D,N,T) #N, -# include "bpf-helpers.def" -#undef DEF_HELPER - NULL, - NULL, - NULL, - NULL -}; - -/* Return the builtin code corresponding to the kernel helper builtin - __builtin_NAME, or 0 if the name doesn't correspond to a kernel - helper builtin. */ - -static inline int -bpf_helper_code (const char *name) -{ - int i; - - for (i = 1; i < BPF_BUILTIN_HELPER_MAX; ++i) - if (strcmp (name, bpf_helper_names[i]) == 0) - return i; - - return 0; -} - static GTY (()) tree bpf_builtins[(int) BPF_BUILTIN_MAX]; /* Initialize the per-function machine status. */ @@ -149,7 +172,7 @@ void bpf_target_macros (cpp_reader *pfile) { builtin_define ("__BPF__"); - + if (TARGET_BIG_ENDIAN) builtin_define ("__BPF_BIG_ENDIAN__"); else @@ -187,7 +210,7 @@ bpf_target_macros (cpp_reader *pfile) case LINUX_V5_1: version_code = "0x50100"; break; case LINUX_V5_2: version_code = "0x50200"; break; default: - gcc_unreachable (); + gcc_unreachable (); } kernel_version_code = ACONCAT (("__BPF_KERNEL_VERSION_CODE__=", @@ -359,7 +382,7 @@ bpf_expand_prologue (void) insn = emit_move_insn (stack_pointer_rtx, hard_frame_pointer_rtx); RTX_FRAME_RELATED_P (insn) = 1; - + if (size > 0) { insn = emit_insn (gen_rtx_SET (stack_pointer_rtx, @@ -528,7 +551,7 @@ bpf_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x0 = XEXP (x, 0); rtx x1 = XEXP (x, 1); - + if (bpf_address_base_p (x0, strict) && GET_CODE (x1) == CONST_INT) return IN_RANGE (INTVAL (x1), -1 - 0x7fff, 0x7fff); @@ -681,13 +704,16 @@ bpf_output_call (rtx target) break; case SYMBOL_REF: { - const char *function_name = XSTR (target, 0); - int code; - - if (strncmp (function_name, "__builtin_bpf_helper_", 21) == 0 - && ((code = bpf_helper_code (function_name + 21)) != 0)) + tree decl = SYMBOL_REF_DECL (target); + tree attr; + + if (decl + && (attr = lookup_attribute ("kernel_helper", + DECL_ATTRIBUTES (decl)))) { - xops[0] = GEN_INT (code); + tree attr_args = TREE_VALUE (attr); + + xops[0] = GEN_INT (TREE_INT_CST_LOW (TREE_VALUE (attr_args))); output_asm_insn ("call\t%0", xops); } else @@ -792,40 +818,7 @@ def_builtin (const char *name, enum bpf_builtins code, tree type) static void bpf_init_builtins (void) { - /* Built-ins for calling kernel helpers. */ - - tree pt = build_pointer_type (void_type_node); - tree const_void_type - = build_qualified_type (void_type_node, TYPE_QUAL_CONST); - tree cpt = build_pointer_type (const_void_type); - tree st = short_integer_type_node; - tree ust = uint16_type_node; - tree it = integer_type_node; - tree ut = unsigned_type_node; - tree const_char_type - = build_qualified_type (char_type_node, TYPE_QUAL_CONST); - tree cst = build_pointer_type (const_char_type); - tree vt = void_type_node; - tree ult = long_unsigned_type_node; - tree u32t = uint32_type_node; - tree u64t = uint64_type_node; - tree llt = long_long_integer_type_node; tree ullt = long_long_unsigned_type_node; - -#define TYPES build_function_type_list -#define VTYPES build_varargs_function_type_list -#define DEF_HELPER(V,D,N,T) \ - do \ - { \ - if (bpf_kernel >= (V)) \ - def_builtin ("__builtin_bpf_helper_" #N, \ - BPF_BUILTIN_HELPER_##D, \ - T); \ - } while (0); -# include "bpf-helpers.def" -#undef TYPES -#undef VTYPES -#undef DEF_HELPER /* Built-ins for BPF_LD_ABS and BPF_LD_IND instructions. */ @@ -844,30 +837,17 @@ bpf_init_builtins (void) with bpf_init_builtins. */ static rtx -bpf_expand_builtin (tree exp, rtx target, +bpf_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED, - int ignore) + int ignore ATTRIBUTE_UNUSED) { tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); int code = DECL_MD_FUNCTION_CODE (fndecl); - if (code >= 1 && code < BPF_BUILTIN_HELPER_MAX) - { - /* This is a builtin to call a kernel helper function. - - For these builtins, we just expand the function call normally - with expand_call like we would do for a libcall. The function - bpf_output_call below will then do The Right Thing (TM), - recognizing the name of the called __builtin_helper_* symbol - and emitting the corresponding CALL N instruction whenever - necessary. */ - - return expand_call (exp, target, ignore); - } - else if (code == BPF_BUILTIN_LOAD_BYTE - || code == BPF_BUILTIN_LOAD_HALF - || code == BPF_BUILTIN_LOAD_WORD) + if (code == BPF_BUILTIN_LOAD_BYTE + || code == BPF_BUILTIN_LOAD_HALF + || code == BPF_BUILTIN_LOAD_WORD) { /* Expand an indirect load from the sk_buff in the context. There is just one argument to the builtin, which is the diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 37a675aa2a5..79833171c5a 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2446,6 +2446,7 @@ GCC plugins may provide their own attributes. * ARM Function Attributes:: * AVR Function Attributes:: * Blackfin Function Attributes:: +* BPF Function Attributes:: * CR16 Function Attributes:: * C-SKY Function Attributes:: * Epiphany Function Attributes:: @@ -4657,6 +4658,24 @@ all registers except the stack pointer should be saved in the prologue regardless of whether they are used or not. @end table +@node BPF Function Attributes +@subsection BPF Function Attributes + +These function attributes are supported by the BPF back end: + +@table @code +@item kernel_helper +@cindex @code{kernel helper}, function attribute, BPF +use this attribute to indicate the specified function declaration is a +kernel helper. The helper function is passed as an argument to the +attribute. Example: + +@smallexample +int bpf_probe_read (void *dst, int size, const void *unsafe_ptr) + __attribute__ ((kernel_helper (4))); +@end smallexample +@end table + @node CR16 Function Attributes @subsection CR16 Function Attributes @@ -13858,7 +13877,6 @@ instructions, but allow the compiler to schedule those calls. * AVR Built-in Functions:: * Blackfin Built-in Functions:: * BPF Built-in Functions:: -* BPF Kernel Helpers:: * FR-V Built-in Functions:: * MIPS DSP Built-in Functions:: * MIPS Paired-Single Support:: @@ -14879,158 +14897,6 @@ Load 16-bits from the @code{struct sk_buff} packet data pointed by the register Load 32-bits from the @code{struct sk_buff} packet data pointed by the register @code{%r6} and return it. @end deftypefn -@node BPF Kernel Helpers -@subsection BPF Kernel Helpers - -These built-in functions are available for calling kernel helpers, and -they are available depending on the kernel version selected as the -CPU. - -Rather than using the built-ins directly, it is preferred for programs -to include @file{bpf-helpers.h} and use the wrappers defined there. - -For a full description of what the helpers do, the arguments they -take, and the returned value, see the -@file{linux/include/uapi/linux/bpf.h} in a Linux source tree. - -@smallexample -void *__builtin_bpf_helper_map_lookup_elem (void *map, void *key) -int __builtin_bpf_helper_map_update_elem (void *map, void *key, - void *value, - unsigned long long flags) -int __builtin_bpf_helper_map_delete_elem (void *map, const void *key) -int __builtin_bpf_helper_map_push_elem (void *map, const void *value, - unsigned long long flags) -int __builtin_bpf_helper_map_pop_elem (void *map, void *value) -int __builtin_bpf_helper_map_peek_elem (void *map, void *value) -int __builtin_bpf_helper_clone_redirect (void *skb, - unsigned int ifindex, - unsigned long long flags) -int __builtin_bpf_helper_skb_get_tunnel_key (void *ctx, void *key, int size, int flags) -int __builtin_bpf_helper_skb_set_tunnel_key (void *ctx, void *key, int size, int flags) -int __builtin_bpf_helper_skb_get_tunnel_opt (void *ctx, void *md, int size) -int __builtin_bpf_helper_skb_set_tunnel_opt (void *ctx, void *md, int size) -int __builtin_bpf_helper_skb_get_xfrm_state (void *ctx, int index, void *state, - int size, int flags) -static unsigned long long __builtin_bpf_helper_skb_cgroup_id (void *ctx) -static unsigned long long __builtin_bpf_helper_skb_ancestor_cgroup_id - (void *ctx, int level) -int __builtin_bpf_helper_skb_vlan_push (void *ctx, __be16 vlan_proto, __u16 vlan_tci) -int __builtin_bpf_helper_skb_vlan_pop (void *ctx) -int __builtin_bpf_helper_skb_ecn_set_ce (void *ctx) - -int __builtin_bpf_helper_skb_load_bytes (void *ctx, int off, void *to, int len) -int __builtin_bpf_helper_skb_load_bytes_relative (void *ctx, int off, void *to, int len, __u32 start_header) -int __builtin_bpf_helper_skb_store_bytes (void *ctx, int off, void *from, int len, int flags) -int __builtin_bpf_helper_skb_under_cgroup (void *ctx, void *map, int index) -int __builtin_bpf_helper_skb_change_head (void *, int len, int flags) -int __builtin_bpf_helper_skb_pull_data (void *, int len) -int __builtin_bpf_helper_skb_change_proto (void *ctx, __be16 proto, __u64 flags) -int __builtin_bpf_helper_skb_change_type (void *ctx, __u32 type) -int __builtin_bpf_helper_skb_change_tail (void *ctx, __u32 len, __u64 flags) -int __builtin_bpf_helper_skb_adjust_room (void *ctx, __s32 len_diff, __u32 mode, - unsigned long long flags) -@end smallexample - -Other helpers: - -@smallexample -int __builtin_bpf_helper_probe_read (void *dst, unsigned int size, void *src) -unsigned long long __builtin_bpf_helper_ktime_get_ns (void) -int __builtin_bpf_helper_trace_printk (const char *fmt, unsigned int fmt_size, ...) -void __builtin_bpf_helper_tail_call (void *ctx, void *prog_array_map, unsigned int index) -unsigned int __builtin_bpf_helper_get_smp_processor_id (void) -unsigned long long __builtin_bpf_helper_get_current_pid_tgid (void) -unsigned long long __builtin_bpf_helper_get_current_uid_gid (void) -int __builtin_bpf_helper_get_current_comm (void *buf, unsigned int size_of_buf) -unsigned long long __builtin_bpf_helper_perf_event_read (void *map, unsigned long long flags) - -int __builtin_bpf_helper_redirect (unsigned int ifindex, unsigned long long flags) -int __builtin_bpf_helper_redirect_map (void *map, unsigned int key, unsigned long long flags) -int __builtin_bpf_helper_perf_event_output (void *ctx,void *map, unsigned long long flags, void *data, unsigned long long size) -int __builtin_bpf_helper_get_stackid (void *ctx, void *map, unsigned long long flags) -int __builtin_bpf_helper_probe_write_user (void *dst, const void *src, unsigned int len) -int __builtin_bpf_helper_current_task_under_cgroup (void *map, unsigned int index) - -static unsigned long long __builtin_bpf_helper_get_prandom_u32 (void) -int __builtin_bpf_helper_xdp_adjust_head (void *ctx, int offset) -int __builtin_bpf_helper_xdp_adjust_meta (void *ctx, int offset) -int __builtin_bpf_helper_get_socket_cookie (void *ctx) -int __builtin_bpf_helper_setsockopt (void *ctx, int level, int optname, void *optval, - int optlen) -int __builtin_bpf_helper_getsockopt (void *ctx, int level, int optname, void *optval, - int optlen) -int __builtin_bpf_helper_sock_ops_cb_flags_set (void *ctx, int flags) -int __builtin_bpf_helper_sk_redirect_map (void *ctx, void *map, int key, int flags) -int __builtin_bpf_helper_sk_redirect_hash (void *ctx, void *map, void *key, int flags) -int __builtin_bpf_helper_sock_map_update (void *map, void *key, void *value, - unsigned long long flags) -int __builtin_bpf_helper_sock_hash_update (void *map, void *key, void *value, - unsigned long long flags) -int __builtin_bpf_helper_perf_event_read_value (void *map, unsigned long long flags, - void *buf, unsigned int buf_size) -int __builtin_bpf_helper_perf_prog_read_value (void *ctx, void *buf, - unsigned int buf_size) - -int __builtin_bpf_helper_override_return (void *ctx, unsigned long rc) -int __builtin_bpf_helper_msg_redirect_map (void *ctx, void *map, int key, int flags) -int __builtin_bpf_helper_msg_redirect_hash (void *ctx, - void *map, void *key, int flags) -int __builtin_bpf_helper_msg_apply_bytes (void *ctx, int len) -int __builtin_bpf_helper_msg_cork_bytes (void *ctx, int len) -int __builtin_bpf_helper_msg_pull_data (void *ctx, int start, int end, int flags) -int __builtin_bpf_helper_msg_push_data (void *ctx, int start, int end, int flags) -int __builtin_bpf_helper_msg_pop_data (void *ctx, int start, int cut, int flags) -int __builtin_bpf_helper_bind (void *ctx, void *addr, int addr_len) -int __builtin_bpf_helper_xdp_adjust_tail (void *ctx, int offset) -int __builtin_bpf_helper_sk_select_reuseport (void *ctx, void *map, void *key, __u32 flags) -int __builtin_bpf_helper_get_stack (void *ctx, void *buf, int size, int flags) -int __builtin_bpf_helper_fib_lookup (void *ctx, struct bpf_fib_lookup *params, - int plen, __u32 flags) - -int __builtin_bpf_helper_lwt_push_encap (void *ctx, unsigned int type, void *hdr, - unsigned int len) -int __builtin_bpf_helper_lwt_seg6_store_bytes (void *ctx, unsigned int offset, - void *from, unsigned int len) -int __builtin_bpf_helper_lwt_seg6_action (void *ctx, unsigned int action, void *param, - unsigned int param_len) -int __builtin_bpf_helper_lwt_seg6_adjust_srh (void *ctx, unsigned int offset, - unsigned int len) -int __builtin_bpf_helper_rc_repeat (void *ctx) -int __builtin_bpf_helper_rc_keydown (void *ctx, unsigned int protocol, - unsigned long long scancode, unsigned int toggle) -static unsigned long long __builtin_bpf_helper_get_current_cgroup_id (void) -static void *__builtin_bpf_helper_get_local_storage (void *map, unsigned long long flags) -static struct bpf_sock *__builtin_bpf_helper_sk_lookup_tcp (void *ctx, void *tuple, int size, unsigned long long netns_id, unsigned long long flags) -static struct bpf_sock *__builtin_bpf_helper_sk_lookup_udp (void *ctx, void *tuple, int size, unsigned long long netns_id, unsigned long long flags) -int __builtin_bpf_helper_sk_release (struct bpf_sock *sk) -int __builtin_bpf_helper_rc_pointer_rel (void *ctx, int rel_x, int rel_y) -static void __builtin_bpf_helper_spin_lock (struct bpf_spin_lock *lock) -static void __builtin_bpf_helper_spin_unlock (struct bpf_spin_lock *lock) - -static struct bpf_sock *__builtin_bpf_helper_sk_fullsock (struct bpf_sock *sk) -static struct bpf_tcp_sock *__builtin_bpf_helper_tcp_sock (struct bpf_sock *sk) -static struct bpf_sock *__builtin_bpf_helper_get_listener_sock (struct bpf_sock *sk) - -int __builtin_bpf_helper_l3_csum_replace (void *ctx, int off, int from, int to, int flags) -int __builtin_bpf_helper_l4_csum_replace (void *ctx, int off, int from, int to, int flags) -int __builtin_bpf_helper_csum_diff (void *from, int from_size, void *to, int to_size, int seed) - -static unsigned int __builtin_bpf_helper_get_cgroup_classid (void *ctx) -static unsigned int __builtin_bpf_helper_get_route_realm (void *ctx) -static unsigned int __builtin_bpf_helper_get_hash_recalc (void *ctx) -static unsigned long long __builtin_bpf_helper_get_current_task (void *ctx) - -static long long __builtin_bpf_helper_csum_update (void *ctx, __u32 csum) -static void __builtin_bpf_helper_set_hash_invalid (void *ctx) -int __builtin_bpf_helper_get_numa_node_id (void) -int __builtin_bpf_helper_probe_read_str (void *ctx, __u32 size, - const void *unsafe_ptr) -static unsigned int __builtin_bpf_helper_get_socket_uid (void *ctx) -static unsigned int __builtin_bpf_helper_set_hash (void *ctx, __u32 hash) -@end smallexample - - @node FR-V Built-in Functions @subsection FR-V Built-in Functions diff --git a/gcc/testsuite/gcc.target/bpf/helper-bind.c b/gcc/testsuite/gcc.target/bpf/helper-bind.c index 2d1fedc4ce8..8dfde242a23 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-bind.c +++ b/gcc/testsuite/gcc.target/bpf/helper-bind.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *ctx, *addr; int addr_len; - ret = __builtin_bpf_helper_bind (ctx, addr, addr_len); + ret = bpf_bind (ctx, addr, addr_len); } /* { dg-final { scan-assembler "call\t64" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c b/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c index 844c88d3e34..9937d5ab4cc 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c +++ b/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () uint32_t ifindex; uint64_t flags; - ret = __builtin_bpf_helper_redirect (ifindex, flags); + ret = bpf_redirect (ifindex, flags); } /* { dg-final { scan-assembler "call\t23" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c b/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c index a4fb8139234..e38adbc40e7 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c +++ b/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t ifindex; uint64_t flags; - ret = __builtin_bpf_helper_clone_redirect (skb, ifindex, flags); + ret = bpf_clone_redirect (skb, ifindex, flags); } /* { dg-final { scan-assembler "call\t13" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c b/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c index ef38192efd3..a1c8bf5a026 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c +++ b/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint64_t to_size, from_size; int seed; - ret = __builtin_bpf_helper_csum_diff (from, from_size, to, to_size, seed); + ret = bpf_csum_diff (from, from_size, to, to_size, seed); } /* { dg-final { scan-assembler "call\t28" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-csum-update.c b/gcc/testsuite/gcc.target/bpf/helper-csum-update.c index 3cde8678cb5..4f65033acb4 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-csum-update.c +++ b/gcc/testsuite/gcc.target/bpf/helper-csum-update.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb; int csum; - ret = __builtin_bpf_helper_csum_update (skb, csum); + ret = bpf_csum_update (skb, csum); } /* { dg-final { scan-assembler "call\t40" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c b/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c index a7eb6e617e8..5b05378a730 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c +++ b/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *map; uint32_t index; - ret = __builtin_bpf_helper_current_task_under_cgroup (map, index); + ret = bpf_current_task_under_cgroup (map, index); } /* { dg-final { scan-assembler "call\t37" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c b/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c index 9a9f79d402c..8290234108a 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c +++ b/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () int plen; uint32_t flags; - ret = __builtin_bpf_helper_fib_lookup (ctx, params, plen, flags); + ret = bpf_fib_lookup (ctx, params, plen, flags); } /* { dg-final { scan-assembler "call\t69" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c b/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c index 6cfd14d0ad1..5d85a89c632 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () uint32_t ret; void *skb; - ret = __builtin_bpf_helper_get_cgroup_classid (skb); + ret = bpf_get_cgroup_classid (skb); } /* { dg-final { scan-assembler "call\t17" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c index 916dc4d3bb1..b0c0b74c11f 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint64_t ret; - ret = __builtin_bpf_helper_get_current_cgroup_id (); + ret = bpf_get_current_cgroup_id (); } /* { dg-final { scan-assembler "call\t80" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c index efc330c3c98..1e25cd1cc7e 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *buf; uint32_t size_of_buf; - ret = __builtin_bpf_helper_get_current_comm (buf, size_of_buf); + ret = bpf_get_current_comm (buf, size_of_buf); } /* { dg-final { scan-assembler "call\t16" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c index 32d3e9c91d1..1dd7a1e507b 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint64_t ret; - ret = __builtin_bpf_helper_get_current_pid_tgid (); + ret = bpf_get_current_pid_tgid (); } /* { dg-final { scan-assembler "call\t14" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c index 016c134b132..79344d15abf 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint64_t ret; - ret = __builtin_bpf_helper_get_current_task (); + ret = bpf_get_current_task (); } /* { dg-final { scan-assembler "call\t35" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c index 1dc2f9f41e5..b3e7261c35b 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint64_t ret; - ret = __builtin_bpf_helper_get_current_uid_gid (); + ret = bpf_get_current_uid_gid (); } /* { dg-final { scan-assembler "call\t15" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c b/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c index 1db5d871c26..e9d87ae9bcc 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () uint32_t ret; void *skb; - ret = __builtin_bpf_helper_get_hash_recalc (skb); + ret = bpf_get_hash_recalc (skb); } /* { dg-final { scan-assembler "call\t34" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c b/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c index 298da1c949b..500ba787a3a 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { void *ret, *sk; - ret = __builtin_bpf_helper_get_listener_sock (sk); + ret = bpf_get_listener_sock (sk); } /* { dg-final { scan-assembler "call\t98" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c b/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c index 88da67e99ae..1c28ef52c11 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () void *ret, *map; uint64_t flags; - ret = __builtin_bpf_helper_get_local_storage (map, flags); + ret = bpf_get_local_storage (map, flags); } /* { dg-final { scan-assembler "call\t81" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c b/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c index 628e1012152..e6477a5c1ff 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { int ret; - ret = __builtin_bpf_helper_get_numa_node_id (); + ret = bpf_get_numa_node_id (); } /* { dg-final { scan-assembler "call\t42" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c b/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c index 6d3e5bc7a22..f30cafd36b0 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint32_t ret; - ret = __builtin_bpf_helper_get_prandom_u32 (); + ret = bpf_get_prandom_u32 (); } /* { dg-final { scan-assembler "call\t7" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c b/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c index 5056c4adb1f..b7794307802 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () uint32_t ret; void *skb; - ret = __builtin_bpf_helper_get_route_realm (skb); + ret = bpf_get_route_realm (skb); } /* { dg-final { scan-assembler "call\t24" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c b/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c index 655b87341df..7d0e9869826 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint32_t ret; - ret = __builtin_bpf_helper_get_smp_processor_id (); + ret = bpf_get_smp_processor_id (); } /* { dg-final { scan-assembler "call\t8" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c b/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c index afd17ddcd50..e2e421f9859 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () uint64_t ret; void *skb; - ret = __builtin_bpf_helper_get_socket_cookie (skb); + ret = bpf_get_socket_cookie (skb); } /* { dg-final { scan-assembler "call\t46" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c b/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c index 3a274c965f7..343f86656d1 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () uint32_t ret; void *skb; - ret = __builtin_bpf_helper_get_socket_uid (skb); + ret = bpf_get_socket_uid (skb); } /* { dg-final { scan-assembler "call\t47" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-stack.c b/gcc/testsuite/gcc.target/bpf/helper-get-stack.c index bbcdeb58775..cc3f6a06bb2 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-stack.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-stack.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t size; uint64_t flags; - ret = __builtin_bpf_helper_get_stack (regs, buf, size, flags); + ret = bpf_get_stack (regs, buf, size, flags); } /* { dg-final { scan-assembler "call\t67" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c b/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c index 319d15cd2fa..cc3ecb01a05 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c +++ b/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *ctx, *map; uint64_t flags; - ret = __builtin_bpf_helper_get_stackid (ctx, map, flags); + ret = bpf_get_stackid (ctx, map, flags); } /* { dg-final { scan-assembler "call\t27" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c b/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c index fb16f15e6ea..c4b32982ed7 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c +++ b/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,8 +12,8 @@ foo () int level, optname, optlen; char *optval; - ret = __builtin_bpf_helper_getsockopt (bpf_socket, level, - optname, optval, optlen); + ret = bpf_getsockopt (bpf_socket, level, + optname, optval, optlen); } /* { dg-final { scan-assembler "call\t57" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c b/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c index 405df057e30..77f1661f387 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c +++ b/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c @@ -1,12 +1,14 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { uint64_t ret; - ret = __builtin_bpf_helper_ktime_get_ns (); + ret = bpf_ktime_get_ns (); } /* { dg-final { scan-assembler "call\t5" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c b/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c index ac17662c5d6..c3f1b78397a 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c +++ b/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t offset; uint64_t from, to, size; - ret = __builtin_bpf_helper_l3_csum_replace (skb, offset, from, to, size); + ret = bpf_l3_csum_replace (skb, offset, from, to, size); } /* { dg-final { scan-assembler "call\t10" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c b/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c index 52b5514b6cb..fd54f0b5e88 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c +++ b/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t offset; uint64_t from, to, size; - ret = __builtin_bpf_helper_l4_csum_replace (skb, offset, from, to, size); + ret = bpf_l4_csum_replace (skb, offset, from, to, size); } /* { dg-final { scan-assembler "call\t11" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c index 1baed27fac7..c6d4769b742 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c +++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb, *hdr; uint32_t type, len; - ret = __builtin_bpf_helper_lwt_push_encap (skb, type, hdr, len); + ret = bpf_lwt_push_encap (skb, type, hdr, len); } /* { dg-final { scan-assembler "call\t73" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c index ccc94c1af9d..4cd7052806b 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c +++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,8 +11,8 @@ foo () void *skb, *param; uint32_t action, param_len; - ret = __builtin_bpf_helper_lwt_seg6_action (skb, action, - param, param_len); + ret = bpf_lwt_seg6_action (skb, action, + param, param_len); } /* { dg-final { scan-assembler "call\t76" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c index 5e95124ad0f..adc8dc414df 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c +++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb; uint32_t offset, delta; - ret = __builtin_bpf_helper_lwt_seg6_adjust_srh (skb, offset, + ret = bpf_lwt_seg6_adjust_srh (skb, offset, delta); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c index 098f97680f2..a35e917d575 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c +++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,8 +11,7 @@ foo () void *skb, *from; uint32_t offset, len; - ret = __builtin_bpf_helper_lwt_seg6_store_bytes (skb, offset, - from, len); + ret = bpf_lwt_seg6_store_bytes (skb, offset, from, len); } /* { dg-final { scan-assembler "call\t74" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c index b8a6cdec4ee..0200b15eb45 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c +++ b/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c @@ -1,4 +1,7 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +#include char *map () { return 0; } @@ -8,7 +11,7 @@ foo () int ret; char *key = 0; - ret = __builtin_bpf_helper_map_delete_elem (map (), key); + ret = bpf_map_delete_elem (map (), key); } /* { dg-final { scan-assembler "call\t3" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c index 839cfc423a7..1d443a05138 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c +++ b/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c @@ -1,4 +1,7 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +#include char *map () { return 0; } @@ -6,7 +9,7 @@ void foo () { char *key = 0, *value = 0; - value = __builtin_bpf_helper_map_lookup_elem (map (), key); + value = bpf_map_lookup_elem (map (), key); } /* { dg-final { scan-assembler "call\t1" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c index 6d0acb1dcb7..de833f202a9 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c +++ b/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c @@ -1,4 +1,7 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +#include char *map () { return 0; } @@ -8,7 +11,7 @@ foo () int ret; char *value = 0; - ret = __builtin_bpf_helper_map_peek_elem (map (), value); + ret = bpf_map_peek_elem (map (), value); } /* { dg-final { scan-assembler "call\t89" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c index 71a7851ca9c..7d76f853f38 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c +++ b/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c @@ -1,4 +1,7 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +#include char *map () { return 0; } @@ -8,7 +11,7 @@ foo () int ret; char *value = 0; - ret = __builtin_bpf_helper_map_pop_elem (map (), value); + ret = bpf_map_pop_elem (map (), value); } /* { dg-final { scan-assembler "call\t88" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c index 53bc0ac5dd7..b4b2a8ef1ef 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c +++ b/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-std=gnu99" } */ +#include + char *map () { return 0; } void @@ -10,7 +12,7 @@ foo () char *value = 0; long long flags = 0; - ret = __builtin_bpf_helper_map_push_elem (map (), value, flags); + ret = bpf_map_push_elem (map (), value, flags); } /* { dg-final { scan-assembler "call\t87" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c index 6281442ba3d..6cceafe62e3 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c +++ b/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-std=gnu99" } */ +#include + char *map () { return 0; } void @@ -10,7 +12,7 @@ foo () long long flags = 0; char *key = 0, *value = 0; - ret = __builtin_bpf_helper_map_update_elem (map (), key, value, flags); + ret = bpf_map_update_elem (map (), key, value, flags); } /* { dg-final { scan-assembler "call\t2" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c index 3b831acad64..9c8ef9d0c88 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *msg; uint32_t bytes; - ret = __builtin_bpf_helper_msg_apply_bytes (msg, bytes); + ret = bpf_msg_apply_bytes (msg, bytes); } /* { dg-final { scan-assembler "call\t61" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c index 2c4ee218832..988a04dfb15 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *msg; uint32_t bytes; - ret = __builtin_bpf_helper_msg_cork_bytes (msg, bytes); + ret = bpf_msg_cork_bytes (msg, bytes); } /* { dg-final { scan-assembler "call\t62" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c b/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c index 377c036603e..567904433f9 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t start, pop; uint64_t flags; - ret = __builtin_bpf_helper_msg_pop_data (skb, start, pop, flags); + ret = bpf_msg_pop_data (skb, start, pop, flags); } /* { dg-final { scan-assembler "call\t91" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c b/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c index ef27493122b..77141019a9a 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c @@ -1,16 +1,17 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { int ret; void *msg; - uint32_t start, end; - uint64_t flags; + int len; - ret = __builtin_bpf_helper_msg_pull_data (msg, start, end, flags); + ret = bpf_msg_pull_data (msg, len); } /* { dg-final { scan-assembler "call\t63" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c b/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c index 9e256bc5ca7..40b936162fc 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t start, len; uint64_t flags; - ret = __builtin_bpf_helper_msg_push_data (skb, start, len, flags); + ret = bpf_msg_push_data (skb, start, len, flags); } /* { dg-final { scan-assembler "call\t90" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c index 2e9d4137d66..6ac680cc098 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *msg, *map, *key; uint64_t flags; - ret = __builtin_bpf_helper_msg_redirect_hash (msg, map, key, + ret = bpf_msg_redirect_hash (msg, map, key, flags); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c index f5f8405e324..ef69f111183 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c +++ b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint64_t key; uint64_t flags; - ret = __builtin_bpf_helper_msg_redirect_map (msg, map, key, + ret = bpf_msg_redirect_map (msg, map, key, flags); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-override-return.c b/gcc/testsuite/gcc.target/bpf/helper-override-return.c index 3bd5424353f..380fd59567d 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-override-return.c +++ b/gcc/testsuite/gcc.target/bpf/helper-override-return.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *regs; uint64_t rc; - ret = __builtin_bpf_helper_override_return (regs, rc); + ret = bpf_override_return (regs, rc); } /* { dg-final { scan-assembler "call\t58" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c b/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c index afb32010bdd..24ed565097e 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c +++ b/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ #include +#include void foo () @@ -11,7 +12,7 @@ foo () void *data; uint64_t size; - ret = __builtin_bpf_helper_perf_event_output (ctx, map, flags, data, size); + ret = bpf_perf_event_output (ctx, map, flags, data, size); } /* { dg-final { scan-assembler "call\t25" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c index 1d512c9ec65..6692f649437 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c +++ b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint64_t flags; uint64_t buf_size; - ret = __builtin_bpf_helper_perf_event_read_value (map, flags, buf, buf_size); + ret = bpf_perf_event_read_value (map, flags, buf, buf_size); } /* { dg-final { scan-assembler "call\t55" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c index f099a09d66f..674058daa8d 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c +++ b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *map; uint64_t flags; - ret = __builtin_bpf_helper_perf_event_read (map, flags); + ret = bpf_perf_event_read (map, flags); } /* { dg-final { scan-assembler "call\t22" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c b/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c index 00c4a3a78b5..7f0a8011ed2 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c +++ b/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *ctx, *buf; uint64_t buf_size; - ret = __builtin_bpf_helper_perf_prog_read_value (ctx, buf, buf_size); + ret = bpf_perf_prog_read_value (ctx, buf, buf_size); } /* { dg-final { scan-assembler "call\t56" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c b/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c index fd04760221d..0774da42ad3 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c +++ b/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () void *dst; const void *unsafe_ptr; - ret = __builtin_bpf_helper_probe_read_str (dst, size, unsafe_ptr); + ret = bpf_probe_read_str (dst, size, unsafe_ptr); } /* { dg-final { scan-assembler "call\t45" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-probe-read.c b/gcc/testsuite/gcc.target/bpf/helper-probe-read.c index a77a907767b..64261c56f92 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-probe-read.c +++ b/gcc/testsuite/gcc.target/bpf/helper-probe-read.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *src, *dst; uint32_t size; - ret = __builtin_bpf_helper_probe_read (dst, size, src); + ret = bpf_probe_read (dst, size, src); } /* { dg-final { scan-assembler "call\t4" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c b/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c index bf226206769..127ae61c8a4 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c +++ b/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *dst, *src; uint32_t len; - ret = __builtin_bpf_helper_probe_write_user (dst, src, len); + ret = bpf_probe_write_user (dst, src, len); } /* { dg-final { scan-assembler "call\t36" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c b/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c index 58e9395dbeb..c419ee06c5c 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c +++ b/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t protocol, toggle; uint64_t scancode; - ret = __builtin_bpf_helper_rc_keydown (ctx, protocol, + ret = bpf_rc_keydown (ctx, protocol, scancode, toggle); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c b/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c index e776bc75963..ca0a5c4ac75 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c +++ b/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *ctx; int32_t rel_x, rel_y; - ret = __builtin_bpf_helper_rc_pointer_rel (ctx, rel_x, rel_y); + ret = bpf_rc_pointer_rel (ctx, rel_x, rel_y); } /* { dg-final { scan-assembler "call\t92" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c b/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c index 0ebc7de5bdf..52d83e4a980 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c +++ b/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () int ret; void *ctx; - ret = __builtin_bpf_helper_rc_repeat (ctx); + ret = bpf_rc_repeat (ctx); } /* { dg-final { scan-assembler "call\t77" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c b/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c index daeecc2a01e..0d059778781 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c +++ b/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t key; uint64_t flags; - ret = __builtin_bpf_helper_redirect_map (map, key, flags); + ret = bpf_redirect_map (map, key, flags); } /* { dg-final { scan-assembler "call\t51" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c b/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c index 4bc63ffa063..adbc41bce19 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c +++ b/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { void *skb; - __builtin_bpf_helper_set_hash_invalid (skb); + bpf_set_hash_invalid (skb); } /* { dg-final { scan-assembler "call\t41" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-set-hash.c b/gcc/testsuite/gcc.target/bpf/helper-set-hash.c index d01ae6eb268..a36cd6b56ec 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-set-hash.c +++ b/gcc/testsuite/gcc.target/bpf/helper-set-hash.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb; uint32_t hash; - ret = __builtin_bpf_helper_set_hash (skb, hash); + ret = bpf_set_hash (skb, hash); } /* { dg-final { scan-assembler "call\t48" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c b/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c index 6f3b450639e..f79c2a86783 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c +++ b/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -12,8 +14,7 @@ foo () void *optval; int optlen; - ret = __builtin_bpf_helper_setsockopt (bpf_socket, level, optname, - optval, optlen); + ret = bpf_setsockopt (bpf_socket, level, optname, optval, optlen); } /* { dg-final { scan-assembler "call\t49" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c b/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c index abe813d94f6..9e66e94f57f 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { void *ret, *sk; - ret = __builtin_bpf_helper_sk_fullsock (sk); + ret = bpf_sk_fullsock (sk); } /* { dg-final { scan-assembler "call\t95" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c index 4408640a6b2..1adcc692068 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,10 +12,10 @@ foo () uint32_t tuple_size; uint64_t netns, flags; - ret = __builtin_bpf_helper_sk_lookup_tcp (ctx, - tuple, - tuple_size, - netns, flags); + ret = bpf_sk_lookup_tcp (ctx, + tuple, + tuple_size, + netns, flags); } /* { dg-final { scan-assembler "call\t84" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c index 4c50f9c6327..8bbd40bf387 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t tuple_size; uint64_t netns, flags; - ret = __builtin_bpf_helper_sk_lookup_udp (ctx, + ret = bpf_sk_lookup_udp (ctx, tuple, tuple_size, netns, flags); diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c index 7047c9f1290..f449b5b8254 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,8 +11,7 @@ foo () void *skb, *map, *key; uint64_t flags; - ret = __builtin_bpf_helper_sk_redirect_hash (skb, map, key, - flags); + ret = bpf_sk_redirect_hash (skb, map, key, flags); } /* { dg-final { scan-assembler "call\t72" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c index 5afb0ac4100..0ebb315d087 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t key; uint64_t flags; - ret = __builtin_bpf_helper_sk_redirect_map (ctx, map, key, flags); + ret = bpf_sk_redirect_map (ctx, map, key, flags); } /* { dg-final { scan-assembler "call\t52" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-release.c b/gcc/testsuite/gcc.target/bpf/helper-sk-release.c index f054c90652c..620dbe9a2ba 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-release.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-release.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () int ret; void *sock; - ret = __builtin_bpf_helper_sk_release (sock); + ret = bpf_sk_release (sock); } /* { dg-final { scan-assembler "call\t86" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c b/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c index 399ad2c0231..0505fc95f66 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *reuse, *map, *key; uint64_t flags; - ret = __builtin_bpf_helper_sk_select_reuseport (reuse, map, + ret = bpf_sk_select_reuseport (reuse, map, key, flags); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c index 07c5875d930..a25421f0017 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () int ret; void *map, *sk; - ret = __builtin_bpf_helper_sk_storage_delete (map, sk); + ret = bpf_sk_storage_delete (map, sk); } /* { dg-final { scan-assembler "call\t108" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c index a199ef0ae64..6d047dd99f4 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,8 +11,7 @@ foo () void *map, *sk, *value; uint64_t flags; - ret = __builtin_bpf_helper_sk_storage_get (map, sk, value, - flags); + ret = bpf_sk_storage_get (map, sk, value, flags); } /* { dg-final { scan-assembler "call\t107" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c b/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c index 88196f5e070..6b1eef9c8cf 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -11,7 +13,7 @@ foo () uint32_t mode; uint64_t flags; - ret = __builtin_bpf_helper_skb_adjust_room (skb, len_diff, mode, flags); + ret = bpf_skb_adjust_room (skb, len_diff, mode, flags); } /* { dg-final { scan-assembler "call\t50" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c index 7c9021e1763..7ad08c17582 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () uint64_t ret; void *skb; - ret = __builtin_bpf_helper_skb_cgroup_id (skb); + ret = bpf_skb_cgroup_id (skb); } /* { dg-final { scan-assembler "call\t79" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c index de6281539fd..f93cefab854 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t len; uint64_t flags; - ret = __builtin_bpf_helper_skb_change_head (skb, len, flags); + ret = bpf_skb_change_head (skb, len, flags); } /* { dg-final { scan-assembler "call\t43" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c index 5738f3cc59b..a41d197fd52 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () int16_t proto; uint64_t flags; - ret = __builtin_bpf_helper_skb_change_proto (skb, proto, flags); + ret = bpf_skb_change_proto (skb, proto, flags); } /* { dg-final { scan-assembler "call\t31" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c index 1fb6b45cd1b..2bfc5979a92 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t len; uint64_t flags; - ret = __builtin_bpf_helper_skb_change_tail (skb, len, flags); + ret = bpf_skb_change_tail (skb, len, flags); } /* { dg-final { scan-assembler "call\t38" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c index bcf22cebc28..46a94213fb3 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb; uint32_t type; - ret = __builtin_bpf_helper_skb_change_type (skb, type); + ret = bpf_skb_change_type (skb, type); } /* { dg-final { scan-assembler "call\t32" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c b/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c index f769993f120..c028ec1d6bb 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () int ret; void *skb; - ret = __builtin_bpf_helper_skb_ecn_set_ce (skb); + ret = bpf_skb_ecn_set_ce (skb); } /* { dg-final { scan-assembler "call\t97" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c index 0d4db236865..aad847256ec 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t size; uint64_t flags; - ret = __builtin_bpf_helper_skb_get_tunnel_key (skb, key, size, flags); + ret = bpf_skb_get_tunnel_key (skb, key, size, flags); } /* { dg-final { scan-assembler "call\t20" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c index 9428657b932..0b39ad728a1 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint8_t *opt; uint32_t size; - ret = __builtin_bpf_helper_skb_get_tunnel_opt (skb, opt, size); + ret = bpf_skb_get_tunnel_opt (skb, opt, size); } /* { dg-final { scan-assembler "call\t29" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c b/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c index 8217b4a17df..de83d91849e 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,8 +12,8 @@ foo () uint32_t index, size; uint64_t flags; - ret = __builtin_bpf_helper_skb_get_xfrm_state (skb, index, - xfrm_state, size, flags); + ret = bpf_skb_get_xfrm_state (skb, index, + xfrm_state, size, flags); } /* { dg-final { scan-assembler "call\t66" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c index bcaa43be9de..cd8c2c2437e 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,9 +11,9 @@ foo () void *skb, *to; uint32_t offset, len, start_header; - ret = __builtin_bpf_helper_skb_load_bytes_relative (skb, offset, - to, len, - start_header); + ret = bpf_skb_load_bytes_relative (skb, offset, + to, len, + start_header); } /* { dg-final { scan-assembler "call\t68" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c index 9da545400c7..1e4612a5c98 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb, *to; uint32_t offset, len; - ret = __builtin_bpf_helper_skb_load_bytes (skb, offset, to, len); + ret = bpf_skb_load_bytes (skb, offset, to, len); } /* { dg-final { scan-assembler "call\t26" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c b/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c index 9bb8b8d6e78..579d8562e3d 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb; uint32_t len; - ret = __builtin_bpf_helper_skb_pull_data (skb, len); + ret = bpf_skb_pull_data (skb, len); } /* { dg-final { scan-assembler "call\t39" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c index 21b835f5cef..85754fdb88a 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint32_t size; uint64_t flags; - ret = __builtin_bpf_helper_skb_set_tunnel_key (skb, key, size, flags); + ret = bpf_skb_set_tunnel_key (skb, key, size, flags); } /* { dg-final { scan-assembler "call\t21" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c index 5a0528ec0a3..591eb48d6ad 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () uint8_t *opt; uint32_t size; - ret = __builtin_bpf_helper_skb_set_tunnel_opt (skb, opt, size); + ret = bpf_skb_set_tunnel_opt (skb, opt, size); } /* { dg-final { scan-assembler "call\t30" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c index a41967cb904..17f8e02e55c 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -12,7 +14,7 @@ foo () uint32_t len; uint64_t flags; - ret = __builtin_bpf_helper_skb_store_bytes (skb, offset, from, len, flags); + ret = bpf_skb_store_bytes (skb, offset, from, len, flags); } /* { dg-final { scan-assembler "call\t9" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c b/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c index 0ccee8bed5c..72adfcd9f3f 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb, *map; uint32_t index; - ret = __builtin_bpf_helper_skb_under_cgroup (skb, map, index); + ret = bpf_skb_under_cgroup (skb, map, index); } /* { dg-final { scan-assembler "call\t33" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c index e99a0ac7802..4d5b347d6da 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -8,7 +10,7 @@ foo () int ret; void *skb; - ret = __builtin_bpf_helper_skb_vlan_pop (skb); + ret = bpf_skb_vlan_pop (skb); } /* { dg-final { scan-assembler "call\t19" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c index dbe52aee1b8..1a43bd42e07 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,7 +12,7 @@ foo () int16_t vlan_proto; uint16_t vlan_tci; - ret = __builtin_bpf_helper_skb_vlan_push (skb, vlan_proto, vlan_tci); + ret = bpf_skb_vlan_push (skb, vlan_proto, vlan_tci); } /* { dg-final { scan-assembler "call\t18" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c b/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c index bbc4b99a808..8ed2d46c813 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c +++ b/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -10,8 +12,8 @@ foo () uint32_t tuple_size; uint64_t netns, flags; - ret = __builtin_bpf_helper_skc_lookup_tcp (ctx, tuple, - tuple_size, netns, flags); + ret = bpf_skc_lookup_tcp (ctx, tuple, + tuple_size, netns, flags); } /* { dg-final { scan-assembler "call\t99" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c b/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c index bbb77ef9ad5..81ff4dd7e8b 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skops, *map, *key; uint64_t flags; - ret = __builtin_bpf_helper_sock_hash_update (skops, map, key, + ret = bpf_sock_hash_update (skops, map, key, flags); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c b/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c index 301e59e975b..fbb5d7556d4 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skops, *map, *key; uint64_t flags; - ret = __builtin_bpf_helper_sock_map_update (skops, map, key, + ret = bpf_sock_map_update (skops, map, key, flags); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c b/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c index 2056312bcf3..4efd69a5543 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *bpf_sock; int argval; - ret = __builtin_bpf_helper_sock_ops_cb_flags_set (bpf_sock, + ret = bpf_sock_ops_cb_flags_set (bpf_sock, argval); } diff --git a/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c b/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c index 4178914ae13..8358e88fd9e 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c +++ b/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { void *lock; - __builtin_bpf_helper_spin_lock (lock); + bpf_spin_lock (lock); } /* { dg-final { scan-assembler "call\t93" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c b/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c index c2416b66994..400695f7aae 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c +++ b/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { void *lock; - __builtin_bpf_helper_spin_unlock (lock); + bpf_spin_unlock (lock); } /* { dg-final { scan-assembler "call\t94" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-strtol.c b/gcc/testsuite/gcc.target/bpf/helper-strtol.c index e15b6d6b968..53830126d45 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-strtol.c +++ b/gcc/testsuite/gcc.target/bpf/helper-strtol.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include #include +#include void foo () @@ -12,7 +14,7 @@ foo () uint64_t flags; size_t buf_len; - ret = __builtin_bpf_helper_strtol (buf, buf_len, flags, &res); + ret = bpf_strtol (buf, buf_len, flags, &res); } /* { dg-final { scan-assembler "call\t105" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-strtoul.c b/gcc/testsuite/gcc.target/bpf/helper-strtoul.c index bc0d77656d2..f648a2bb54c 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-strtoul.c +++ b/gcc/testsuite/gcc.target/bpf/helper-strtoul.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include #include +#include void foo () @@ -12,7 +14,7 @@ foo () uint64_t flags; size_t buf_len; - ret = __builtin_bpf_helper_strtoul (buf, buf_len, flags, &res); + ret = bpf_strtoul (buf, buf_len, flags, &res); } /* { dg-final { scan-assembler "call\t106" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c index 803584171dd..55a31e4f55c 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include #include +#include void foo () @@ -10,8 +12,7 @@ foo () void *ctx, *buf; size_t buf_len; - ret = __builtin_bpf_helper_sysctl_get_current_value (ctx, buf, - buf_len); + ret = bpf_sysctl_get_current_value (ctx, buf, buf_len); } /* { dg-final { scan-assembler "call\t102" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c index a748b4bf911..bacb288c4a9 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include #include +#include void foo () @@ -11,8 +13,7 @@ foo () size_t buf_len; uint64_t flags; - ret = __builtin_bpf_helper_sysctl_get_name (ctx, buf, - buf_len, flags); + ret = bpf_sysctl_get_name (ctx, buf, buf_len, flags); } /* { dg-final { scan-assembler "call\t101" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c index 2c4835100c9..5ad36442280 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include #include +#include void foo () @@ -10,8 +12,7 @@ foo () void *ctx, *buf; size_t buf_len; - ret = __builtin_bpf_helper_sysctl_get_new_value (ctx, buf, - buf_len); + ret = bpf_sysctl_get_new_value (ctx, buf, buf_len); } /* { dg-final { scan-assembler "call\t103" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c index fc3780da7e2..2b3b3af6355 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c +++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include #include +#include void foo () @@ -10,8 +12,7 @@ foo () void *ctx, *buf; size_t buf_len; - ret = __builtin_bpf_helper_sysctl_set_new_value (ctx, buf, - buf_len); + ret = bpf_sysctl_set_new_value (ctx, buf, buf_len); } /* { dg-final { scan-assembler "call\t104" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-tail-call.c b/gcc/testsuite/gcc.target/bpf/helper-tail-call.c index 618064f4aea..0f35b00a786 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-tail-call.c +++ b/gcc/testsuite/gcc.target/bpf/helper-tail-call.c @@ -1,14 +1,17 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { + int ret; void *ctx, *prog_array_map; uint32_t index; - __builtin_bpf_helper_tail_call (ctx, prog_array_map, index); + ret = bpf_tail_call (ctx, prog_array_map, index); } /* { dg-final { scan-assembler "call\t12" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c b/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c index 95846c6f2d7..bada09f3546 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c +++ b/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,9 +11,9 @@ foo () void *sk, *iph, *th; uint32_t iph_len, th_len; - ret = __builtin_bpf_helper_tcp_check_syncookie (sk, iph, - iph_len, - th, th_len); + ret = bpf_tcp_check_syncookie (sk, iph, + iph_len, + th, th_len); } /* { dg-final { scan-assembler "call\t100" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c b/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c index ab8f2de05d8..cd6d995f5bf 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c +++ b/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c @@ -1,13 +1,15 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () { void *ret, *sk; - ret = __builtin_bpf_helper_tcp_sock (sk); + ret = bpf_tcp_sock (sk); } /* { dg-final { scan-assembler "call\t96" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c b/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c index fcf9d5c9e50..135ae295d84 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c +++ b/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c @@ -1,4 +1,7 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +#include char *map () { return 0; } @@ -7,7 +10,7 @@ foo () { int ret; - ret = __builtin_bpf_helper_trace_printk ("foo %d %d", sizeof ("foo %d %d"), 10, 20); + ret = bpf_trace_printk ("foo %d %d", sizeof ("foo %d %d"), 10, 20); } /* { dg-final { scan-assembler "call\t6" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c index 3dce5434535..352d9d68023 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c +++ b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *xdp_md; int delta; - ret = __builtin_bpf_helper_xdp_adjust_head (xdp_md, delta); + ret = bpf_xdp_adjust_head (xdp_md, delta); } /* { dg-final { scan-assembler "call\t44" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c index 38a13748737..ef5da4b10e2 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c +++ b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *xdp_md; int delta; - ret = __builtin_bpf_helper_xdp_adjust_meta (xdp_md, delta); + ret = bpf_xdp_adjust_meta (xdp_md, delta); } /* { dg-final { scan-assembler "call\t54" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c index 319b65a233d..db55168144b 100644 --- a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c +++ b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ #include +#include void foo () @@ -9,7 +10,7 @@ foo () void *xdp_md; int delta; - ret = __builtin_bpf_helper_xdp_adjust_tail (xdp_md, delta); + ret = bpf_xdp_adjust_tail (xdp_md, delta); } /* { dg-final { scan-assembler "call\t65" } } */ diff --git a/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c index ce193ec14bf..8e88c93cac9 100644 --- a/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c +++ b/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ #include +#include void foo () @@ -9,7 +11,7 @@ foo () void *skb; int ancestor_level; - ret = __builtin_bpf_helper_skb_ancestor_cgroup_id (skb, + ret = bpf_skb_ancestor_cgroup_id (skb, ancestor_level); }