1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
2 #ifndef __BPF_LEGACY__
3 #define __BPF_LEGACY__
4 
5 #if __GNUC__ && !__clang__
6 /* Functions to emit BPF_LD_ABS and BPF_LD_IND instructions.  We
7  * provide the "standard" names as synonyms of the corresponding GCC
8  * builtins. Note how the SKB argument is ignored.
9  */
10 #define load_byte(skb, off) __builtin_bpf_load_byte(off)
11 #define load_half(skb, off) __builtin_bpf_load_half(off)
12 #define load_word(skb, off) __builtin_bpf_load_word(off)
13 #else
14 /* llvm builtin functions that eBPF C program may use to
15  * emit BPF_LD_ABS and BPF_LD_IND instructions
16  */
17 unsigned long long load_byte(void *skb, unsigned long long off) asm("llvm.bpf.load.byte");
18 unsigned long long load_half(void *skb, unsigned long long off) asm("llvm.bpf.load.half");
19 unsigned long long load_word(void *skb, unsigned long long off) asm("llvm.bpf.load.word");
20 #endif
21 
22 #endif
23 
24