Fail to compile with newer kernels >= 4.19
The BPF samples/bpf/ in this repo does NOT compile against newer kernel (according to Yoel: kernels >= 4.19).
This is caused by the kernel source changed, and added more use-cases of asm_volatile_goto (ASM GOTO), which is not supported by clang. This was initially worked around in this kernel commit b1ae32dbab50ed, and in this repo commit fca18b68c34. Unfortunately more ASM GOTO use-cases were added, again causing compile failures.
The upstream kernel address this in commit 6bf3bbe1f4d4c, by creating a include file asm_goto_workaround.h that redefines asm_volatile_goto. This is kind of workaround seems hackish...
TODO: Try to comeup with a better solution...
Hello,
Just post some hits for the issue:
--------------------------------------log----------------------------------------
constructs are not supported yet
return GEN_BINARY_RMWcc(LOCK_PREFIX _ASM_SIZE(bts), *addr, c, "Ir", nr);
^
/lib/modules/5.0.0-rc7-00177-gcb268d806972/build//arch/x86/include/asm/rmwcc.h:60:32: note: expanded from macro
'GEN_BINARY_RMWcc'
#define GEN_BINARY_RMWcc(X...) RMWcc_CONCAT(GEN_BINARY_RMWcc, RMWcc_ARGS(X))(X)
^
/lib/modules/5.0.0-rc7-00177-gcb268d806972/build//arch/x86/include/asm/rmwcc.h:10:28: note: expanded from macro
'RMWcc_CONCAT'
#define RMWcc_CONCAT(a, b) __RMWcc_CONCAT(a, b)
^
/lib/modules/5.0.0-rc7-00177-gcb268d806972/build//arch/x86/include/asm/rmwcc.h:9:30: note: expanded from macro
'__RMWcc_CONCAT'
#define __RMWcc_CONCAT(a, b) a ## b
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/lib/modules/5.0.0-rc7-00177-gcb268d806972/build//arch/x86/include/asm/rmwcc.h:54:2: note: expanded from macro
'GEN_BINARY_RMWcc_6'
__GEN_RMWcc(op " %[val], " arg0, var, cc,
^
/lib/modules/5.0.0-rc7-00177-gcb268d806972/build//arch/x86/include/asm/rmwcc.h:21:2: note: expanded from macro
'__GEN_RMWcc'
asm_volatile_goto (fullop "; j" #cc " %l[cc_label]"
^
/lib/modules/5.0.0-rc7-00177-gcb268d806972/build//include/linux/compiler_types.h:188:37: note: expanded from
macro 'asm_volatile_goto'
#define asm_volatile_goto(x...) asm goto(x)
^
.......
----------->&<-----------------------------------------
No wonder i have not enable some config entries?
thanks
I have no idea why it fail to compile in kernel/sample/bpf. in kernel, "make" works well.
This issue clearly states that this project does NOT compile any-longer on kernels >= v.4.19. Why do you report this problem on a kernel v5.0 ?
The compile error you get is due to something else, but once you fix that (by running make headers_install in kernel rootdir) then you are going to hit the issue I desc above, so why are you going this...
I have no idea why it fail to compile in kernel/sample/bpf. in kernel, "make" works well.
This issue clearly states that this project does NOT compile any-longer on kernels >= v.4.19. Why do you report this problem on a kernel v5.0 ?
The compile error you get is due to something else, but once you fix that (by running make headers_install in kernel rootdir) then you are going to hit the issue I desc above, so why are you going this...
Sorry the confused by me.I think the error log is another type. I will update it if you do not mind it. Btw, althought commit 6bf3bbe1f4d4c is hackish as you said, why we add it here to compile bpf successfully unitl we keep up a better way to instead of it?
After applying the patch, now I get other errors (kernel 5.6): error: expected '(' after 'asm'