无法在内联汇编中声明.data [英] Can't declare .data in inline assembly

查看:116
本文介绍了无法在内联汇编中声明.data的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我遇到了一个似乎无法声明.data的问题.我在代码中尝试了各种不同的方法,但在这一部分似乎总是无法解决

Hello I have a problem where I can't seem to declare .data . I've tried various different things with my code and it always seems to break at this part

    asm(
       ".data\n"
       ".file:  .ascii \"/dev/mem\\000\"\n"
    );

我也可以删除.data之后的所有信息,但它们仍会在'.data'处中断.这是在带有C的内联汇编的raspberry pi 2上完成的.如果其余代码相关,请告诉我,但我确定不是.感谢您的帮助!

I can also remove any information after the .data and it will still break at '.data'. This is done on a raspberry pi 2 with inline assembly on C. If the rest of the code is relevant let me know but I'm pretty sure it's not. Thanks for any help!

抱歉我忘了包含错误消息

Apologies I forgot to include the error message

错误:此处的方法名称"的.size表达式的计算结果不为常量

"ERROR: .size expression for 'method name here' does not evaluate to a constant

推荐答案

您不会在内联汇编结束之前还原该节,并且gcc会生成依赖于内联汇编而不更改当前节的代码.

You don't restore the section before the end of the inline assembly, and gcc generate code that relies on inline assembly not changing the current section.

这篇关于无法在内联汇编中声明.data的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆