• Yonghong Song's avatar
    Add "-D __BPF_TRACING__" to frontend compilation flags · 7c4311f6
    Yonghong Song authored
    In 4.17 kernel, x86 build requires compiler asm-goto support. clang
    does not support asm-goto and bpf program compilation started to break.
    The following kernel commit
    
      commit b1ae32dbab50ed19cfc16d225b0fb0114fb13025
      Author: Alexei Starovoitov <ast@kernel.org>
      Date:   Sun May 13 12:32:22 2018 -0700
    
          x86/cpufeature: Guard asm_volatile_goto usage for BPF compilation
    
          Workaround for the sake of BPF compilation which utilizes kernel
          headers, but clang does not support ASM GOTO and fails the build.
    
    workarounded the issue by permitting native clang compilation.
    A warning message, however, is issued:
    
      ./arch/x86/include/asm/cpufeature.h:150:2: warning: "Compiler lacks ASM_GOTO support.
            Add -D __BPF_TRACING__ to your compiler arguments" [-W#warnings]
      #warning "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compil...
       ^
      1 warning generated.
    
    This patch added "-D __BPF_TRACING__" to clang frontend compilation to
    suppress the warning.
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    7c4311f6
loader.cc 13.9 KB