GCC 版本之间的变量属性更改 - "nobits"

variable attributes changes between GCC versions - "nobits"

我在我的项目中使用旧版本的 GCC(版本 6.3.0)- arm 处理器。 然后我转到了更新版本(版本 10.2.1 20201103)- arm 处理器。

当我希望特定部分仅是“space 持有者”时,例如,我使用了一个属性

__attribute__((section(".sctionName,\"aw\",@nobits#")))

使用新的 GCC 版本时出现错误:

Error: junk at end of line, first unrecognized character is `,'

在新的 GCC 版本中是否有执行此操作的选项?

节属性语法在 gcc 6 and gcc 10. The parameter for section is just the section name; the ,\"aw\",@nobits# part appears to be a "dirty-trick" (according to What does the "aw" flag in the section attribute mean?) 之间没有改变,以将限定符注入生成的汇编代码。然而 gcc 10 清楚地检查有效的部分名称,其中 gcc 6 允许任何旧文本并将其简单地插入到代码中。

您可能需要一种更“正式”的方式来定义该部分的行为。或许通过链接描述文件?