[英]Trying to port GCC specific asm goto to Clang
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. 我一直试图将一些GNU扩展转换为实际的标准C,因此它将在clang上运行,知道标准C而不是GNU扩展,我有点亏。
__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. 我试图把它变成实际的asm,但还没有成功。
If you're curious, this is part of a kernel I've just about got to build on clang, besides that one section. 如果你很好奇,这是我刚刚建立在clang上的内核的一部分,除了那一部分。
You seem to be having a problem compiling arch/x86/include/asm/jump_label.h . 您似乎在编译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. 您遇到的实现取决于gcc(v4.5),它添加了一个新的asm goto
语句 ,允许分支到标签。
It appears that Clang/LLVM does NOT support
asm goto
. 似乎Clang / LLVM不支持asm goto
。
As a quick fix to get your Linux kernel compiling properly, you can disable CONFIG_JUMP_LABEL
in your kernel configuration. 作为正确编译Linux内核的快速解决方案,您可以在内核配置中禁用CONFIG_JUMP_LABEL
。 This config option is used to disable the optimisation when the compiler does NOT support asm goto
properly. 此配置选项用于在编译器不支持asm goto
时禁用优化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.