在Makefile里加上-O0
之后
./include/linux/compiler-gcc.h:120:38: error: impossible constraint in ‘asm’
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^~~
./arch/x86/include/asm/cpufeature.h:165:2: note: in expansion of macro ‘asm_volatile_goto’
asm_volatile_goto("1: jmp 6f\n"
^~~~~~~~~~~~~~~~~
由https://stackoverflow.com/questions/11501236/how-to-prevent-gcc-optimizing-in-kernel-modules可知,至少要-O1
才行。