Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

samples/bpf: Add a workaround for asm_inline

This was added in commit eb111869301e ("compiler-types.h: add asm_inline
definition") and breaks samples/bpf as clang does not support asm __inline.

Fixes: eb111869301e ("compiler-types.h: add asm_inline definition")
Co-developed-by: Florent Revest <revest@google.com>
Signed-off-by: Florent Revest <revest@google.com>
Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20191002191652.11432-1-kpsingh@chromium.org

authored by

KP Singh and committed by
Daniel Borkmann
98beb3ed df551058

+12 -1
+12 -1
samples/bpf/asm_goto_workaround.h
··· 3 3 #ifndef __ASM_GOTO_WORKAROUND_H 4 4 #define __ASM_GOTO_WORKAROUND_H 5 5 6 - /* this will bring in asm_volatile_goto macro definition 6 + /* 7 + * This will bring in asm_volatile_goto and asm_inline macro definitions 7 8 * if enabled by compiler and config options. 8 9 */ 9 10 #include <linux/types.h> ··· 12 11 #ifdef asm_volatile_goto 13 12 #undef asm_volatile_goto 14 13 #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") 14 + #endif 15 + 16 + /* 17 + * asm_inline is defined as asm __inline in "include/linux/compiler_types.h" 18 + * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not 19 + * supported by CLANG. 20 + */ 21 + #ifdef asm_inline 22 + #undef asm_inline 23 + #define asm_inline asm 15 24 #endif 16 25 17 26 #define volatile(x...) volatile("")