Clang-14.0.6 compiler throwing unrecognized command line option error during kernel modules compilation

Hi,

Clang-14.0.6 compiler is throwing below error while building kernel modules.
{{
Similar error is posted in below link but no proposer fix proposed.

}}

CC /kernel/modules/qat_driver/quickassist/utilities/libusdm_drv/linux/kernel_space/qae_mem_utils.o
x86_64-linux-gcc.br_real: error: unrecognized command line option ‘-Qunused-arguments’
x86_64-linux-gcc.br_real: error: unrecognized command line option ‘–target=x86_64-linux’
x86_64-linux-gcc.br_real: error: unrecognized command line option ‘–gcc-toolchain=/’
x86_64-linux-gcc.br_real: error: unrecognized command line option ‘-mstack-alignment=8’
x86_64-linux-gcc.br_real: error: unrecognized command line option ‘-mretpoline-external-thunk’
x86_64-linux-gcc.br_real: error: unrecognized command line option ‘-mno-global-merge’

}}
Any input for analyzing issue further?

Regards
Koti

As asked in the linked stackoverflow, are you sure you are using clang here? x86_64-linux-gcc.br_real is that the compiler name? If you thought you were using clang but somehow the build system chose gcc, that’s not a clang issue.

Perhaps your config doesn’t support building with clang and is not good at telling you that? (I know clangbuiltlinux exists but haven’t used it myself)

Certainly seems like x86_64-linux-gcc.br_real: error: unrecognized command line option ‘–gcc-toolchain=/’ is something GCC would say not clang.

If you are in fact using clang then we would need to see the compile command for the file qae_mem_utils. Something that reproduces outside of the Linux build system you have, ideally with a single source file input.

Hi DavidSpickett

Modified module specific Makefile for clang compilation and it’s built successfully last week itself
Thank you For your support.

Regards
Koti

1 Like