BPF: make 'pseudo' function return pointer 80/148680/4
authorAdrian Szyndela <adrian.s@samsung.com>
Wed, 6 Sep 2017 13:14:57 +0000 (15:14 +0200)
committerAdrian Szyndela <adrian.s@samsung.com>
Tue, 10 Oct 2017 11:46:37 +0000 (11:46 +0000)
'pseudo' function returns u64. However, in fact it returns pointers.
It makes difference for 32-bit systems. The generated IR
has additional trunc instruction, which may make further problems,
remote: when passed to eBPF verifier.

This patch is made to handle similar change in llvm.

Change-Id: I4a691bdfa4b10b207197941c589026997b62f8fe

src/cc/export/helpers.h

index 4b6b947..dbedb48 100644 (file)
@@ -366,7 +366,7 @@ u64 load_dword(void *skb, u64 off) {
 void bpf_store_byte(void *skb, u64 off, u64 val) asm("llvm.bpf.store.byte");
 void bpf_store_half(void *skb, u64 off, u64 val) asm("llvm.bpf.store.half");
 void bpf_store_word(void *skb, u64 off, u64 val) asm("llvm.bpf.store.word");
-u64 bpf_pseudo_fd(u64, u64) asm("llvm.bpf.pseudo");
+void *bpf_pseudo_fd(u64, u64) asm("llvm.bpf.pseudo");
 
 static inline void __attribute__((always_inline))
 bpf_store_dword(void *skb, u64 off, u64 val) {