dr_checker icon indicating copy to clipboard operation
dr_checker copied to clipboard

How to compile driver using clang

Open ghost opened this issue 6 years ago • 2 comments

Hi, I encountered a difficulty about how to compile driver using clang and I find your tool can make it so I need your help.

For example, I want to compile the bluetooth module of the drivers in the linux kernel 4.19.9. I substitute the gcc by clang in the Makefile. But there were some mistakes and it says "You are building kernel with non-retpoline compiler, please update your compiler." .

So, if you intend to compile the bluetooth module, what will you do? Could you explain it?

Thanks.

ghost avatar Dec 20 '18 08:12 ghost

Is it for x86_64?

Machiry avatar Dec 24 '18 05:12 Machiry

Is it for x86_64?

Yes. I find that the issue is that clang cannot pass the check before beginning compiling the kernel. Now I find a walk-around to bypass the check, but when I'm compiling, the clang compiler complains about asm

./arch/x86/include/asm/atomic.h:200:1559: error: invalid output constraint
      '=@ccz' in asm
  ...%[ptr]" "\n\t/* output condition code " "z" "*/\n" : "=@cc" "z" (success...

ghost avatar Dec 28 '18 08:12 ghost