- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我一直在尝试将一些 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););
我试图将其转化为实际的 asm,但尚未成功。
如果您好奇的话,除了那一部分之外,这是我即将在 clang 上构建的内核的一部分。
最佳答案
您似乎在编译 arch/x86/include/asm/jump_label.h 时遇到问题.整个代码片段是为了启用对“跳跃标签修补”的支持。一项非常有用的新功能,允许调试(打印日志等),在禁用调试时开销几乎为零。
你遇到的实现 depends on gcc(v4.5) which adds a new asm goto
statement允许分支到标签。
It appears that Clang/LLVM < 9.0.0 does NOT support
asm goto
.
作为让 Linux 内核正确编译的快速修复,您可以在内核配置中禁用 CONFIG_JUMP_LABEL
。当编译器不正确支持 asm goto
时,此配置选项用于禁用优化。
更新:对asm goto
的初始支持是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.
关于c - 尝试将 GCC 特定的 asm goto 移植到 Clang,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18863363/
作为入门编程类(class)的家庭作业,我必须设计并实现一个生成随机数 (1-100) 的程序,然后为玩家提供 7 次猜测以正确猜出该数字。我想出了这个算法: 但是,我不知道如何将算法的这种概念表示转
这个问题在这里已经有了答案: 关闭 14 年前。 此问题与Goto Still Considered Harmful 重复.如果您想进一步讨论这个问题,请使用原始问题。 为什么 GOTO 是糟糕的编
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题吗? 更新问题,以便 editing this post 提供事实和引用来回答它. 关闭3年前。 Improve th
我想知道在这种情况下您不应该使用 goto 而不是使用 while(variable) 是否有原因: :start result=askUser("do you want 1,2,or 3?") sw
是的,我知道 Esdger Dijkstra 说你不应该使用 goto ,但他不是上帝。我认为只要不过分使用无条件分支就可以了。过度使用继承和过度使用分支语句一样有可能创建不可读的代码。 无论如何,现
在 Visual Studio 中 Go To Definition 和 Go To Implementation 有什么区别? 版本:Visual Studio 2015 Update 1 最佳答案
Section 6.8.1 of C11或 C99 ,或 C89 的第 3.6.1 节所有这些似乎都表明 default 和 case x(其中 x 是一些 constant-expression)是
所以我下载了 sublime text 3,据称“Sublime Text 现在扫描项目中的文件,并构建哪些文件包含哪些符号的索引。这支持项目中的 Goto Definition 和 Goto Sym
当goto语句下面放置标签时,编译器如何找到标签的地址进行跳转? C 编程是自上而下的方法,对吗?如果标号位于 goto 语句之上,则可以理解,当标号到达 goto 语句时,其地址就已知。请大家解释一
谁能找出 VBA 中“On error goto -1”和“on error goto 0”之间的区别吗?我尝试过 google 和 msdn,但没有成功。 最佳答案 On Error GoTo 0
每当我运行 code下面它发生在我身上,我在使用 if 存在行时犯了一个错误,因为无论目录是否存在,它都表现为该行从未存在过...... echo off echo echo (c) Ryan L
我知道去函数声明的方法(使用 ctags + Ctrl + ])。但是,如果我不想转至函数声明,而是转至函数定义,该怎么办。 例如: // foo.c #include "foo.h" ... if
我正在尝试用防御性编程来完成这个小程序,但我很难处理这个避免 Loop-Goto 的问题,因为我知道这是糟糕的编程。我尝试过 while 和 do...while 循环,但在一种情况下我没有问题。当我
我正在尝试创建一个宏,允许用户单击按钮,Excel 工作表将执行 1:移至下一个/上一个工作表或 2:复制现有工作表,然后移至复制的工作表。 目前我陷入了处理错误处理情况的困境,并且不知道如何解决它。
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭5 个月前。 Improv
当他们谈论更喜欢汇编而不是更高级的语言时,我正在和某人通电话。他们提到喜欢 goto 语句,我回答说它会导致意大利面条代码。他们回复了“goto $”之类的内容。我说 goto 会散发出代码气味。他们
我有一个简单的数字根计算(即将整数中的所有数字相加,如果总数超过一位数字,则重复该过程,直到最终得到一位数字的答案)。 我的第一个冲动是简单地计算初始字符串中的数字之和,测试结果是否多于一位数字,如果
我对 C# 还很陌生(一周前开始学习),在批处理和表达式 2 方面有一些经验,并且我一直在开发基于文本的游戏,试图了解更多信息。我一开始使用了 goto 语句,但根据我发现的几乎每个人的说法,goto
#include int main() { int i; goto l; for(i = 0; i < 5; i++) { l:printf("Hi\n");
我必须编写一个 C 程序(不使用递归、else、for、while、do {} while 并且使用 if 的构造不得包含“return”)来从数组中查找最大数字。所以现在这是我的代码: #inclu
我是一名优秀的程序员,十分优秀!