• yonghong-song's avatar
    workaround kernel 5.0 asm_volatile_goto issue (#2133) · a753e572
    yonghong-song authored
    Fix issue #2119.
    
    Kernel 5.0 added more usages of asm goto and llvm
    does not support asm goto yet. This resulted in
    compilation error for virtually any bcc scripts.
    
    The workaround here is to redefine asm_volatile_goto to
      asm volatile("invalid use of asm_volatile_goto")
    which can pass clang.
    If bpf program does not use asm_volatile_goto,
    nothing bad will happen. The functions using
    asm_volatile_goto will be thrown away.
    If bpf program accidentally uses asm_volatile_goto,
    a compilation error like below will be printed out:
      <inline asm>:1:2: error: invalid register/token name
              invalid use of asm_volatile_goto
              ^
      LLVM ERROR: Error parsing inline asm
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    a753e572
helpers.h 31.1 KB