Skip to content
  • Yonghong Song's avatar
    samples/bpf: workaround clang asm goto compilation errors · 6bf3bbe1
    Yonghong Song authored
    x86 compilation has required asm goto support since 4.17.
    Since clang does not support asm goto, at 4.17,
    Commit b1ae32db ("x86/cpufeature: Guard asm_volatile_goto usage
    for BPF compilation") worked around the issue by permitting an
    alternative implementation without asm goto for clang.
    
    At 5.0, more asm goto usages appeared.
      [yhs@148 x86]$ egrep -r asm_volatile_goto
      include/asm/cpufeature.h:     asm_volatile_goto("1: jmp 6f\n"
      include/asm/jump_label.h:     asm_volatile_goto("1:"
      include/asm/jump_label.h:     asm_volatile_goto("1:"
      include/asm/rmwcc.h:  asm_volatile_goto (fullop "; j" #cc " %l[cc_label]"     \
      include/asm/uaccess.h:        asm_volatile_goto("\n"                          \
      include/asm/uaccess.h:        asm_volatile_goto("\n"                          \
      [yhs@148 x86]$
    
    Compiling samples/bpf directories, most bpf programs failed
    compilation with error messages like:
      In file included from /home/yhs/work/bpf-next/sa...
    6bf3bbe1