Linux内核模块编译报错:compiler-gcc.h:164:38: error: impossible constraint in ‘asm’
现象:编译内核模块时遇到错误提示
/usr/src/linux-headers-4.19.0-6-common/include/linux/compiler-gcc.h:164:38: error: impossible constraint in ‘asm’
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
原因:gcc高版本编译器在-O0选项下不支持部分优化代码
解决:将-O0改为-O1及以上即可。
参考:optimization - How to prevent gcc optimizing in kernel modules? - Stack Overflow
Linux内核模块编译报错:compiler-gcc.h:164:38: error: impossible constraint in ‘asm’最先出现在Python成神之路。
共有 0 条评论