On 6/11/2021 1:58 AM, Hyeonggon Yoo wrote:> After playing with clang
more a bit, I got to know that
compiletime_assert makes weird link error (undefined reference to
compiletime_assert_XXX), Not a compile error.
I think it's time to CC ClangBuiltLinux maintainers, who work on
clang/llvm build support.
[+CC Nathan and Nick]
I assumeed that compiletime_assert (in linux/compiler.h) will make
compiler error, but it makes no compile error, just makes weird link error.
I'm not sure it it works well with clang, or somewhat buggy status?
I am guessing this alone is why we were keyed into the thread so I am
just going to respond to this.
Unfortunately, this is a known issue with clang:
https://github.com/ClangBuiltLinux/linux/issues/1173
https://bugs.llvm.org/show_bug.cgi?id=16428
As you noticed, building the full kernel will result in a link error but
it would certainly be nicer if it were a compiler error. Something for
us to improve indeed but I am not sure when we will be able to allocate
resources for that. Until then, you can build a full kernel to get the
failing translation unit then use nm or readelf when building the single
translation unit to see if there are any "__compiletime_assert" symbols.
Cheers,
Nathan