I've been trying to turn a bit of GNU extensions in to actual standard C so it'll run on clang, knowing standard C and not GNU extensions, I'm at a bit of a loss.
__asm__ (goto("1:"
STATIC_KEY_INITIAL_NOP
".pushsection __jump_table, \"aw\" \n\t"
_ASM_ALIGN "\n\t"
_ASM_PTR "1b, %l[l_yes], %c0 \n\t"
".popsection \n\t"
: : "i" (key) : : l_yes););
I've tried to turn this in to actual asm, but have yet to be successful.
If you're curious, this is part of a kernel I've just about got to build on clang, besides that one section.
You seem to be having a problem compiling arch/x86/include/asm/jump_label.h. The entire code-snippet is to enable support for "jump label patching". A new feature quite useful to allow debugging(print logs etc.) with have near-zero overhead when debugging is disabled.
The implementation you encounter depends on gcc(v4.5) which adds a new asm goto
statement that allows branching to a label.
It appears that Clang/LLVM < 9.0.0 does NOT support
asm goto
.
As a quick fix to get your Linux kernel compiling properly, you can disable CONFIG_JUMP_LABEL
in your kernel configuration. This config option is used to disable the optimisation when the compiler does NOT support asm goto
properly.
Update: Initial support for asm goto
was added to Clang in v9.0.0.
Initial support for
asm goto
statements (a GNU C extension) has been added for control flow from inline assembly to labels. The main consumers of this construct are the Linux kernel (CONFIG_JUMP_LABEL=y) and glib. There are still a few unsupported corner cases in Clang's integrated assembler and IfConverter. Please file bugs for any issues you run into.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With