海湾合作委员会链接器意外地向后移动位置计数器

发布于 2025-01-31 15:59:39 字数 1374 浏览 1 评论 0原文

我正在开发新的rtems bsp,并且正在修改链接脚本,我

修改了我修改此链接器脚本文件

    .rwbarrier : ALIGN_WITH_INPUT {
        . = ALIGN (bsp_section_rwbarrier_align);
    } > REGION_DATA AT > REGION_DATA

    .vector : ALIGN_WITH_INPUT {
        bsp_section_vector_begin = .;
        . = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;
        bsp_section_vector_end = .;
    } > REGION_VECTOR AT > REGION_VECTOR

让我们假设我们需要将.vector部分放在某个内存区域的中间线:

    .vector : ALIGN_WITH_INPUT {
        . = ALIGN(128);
        bsp_section_vector_begin = .;

现在我得到了此错误:

[build] linkcmds.base:xxx cannot move location counter backwards (from 0000000060022380 to 0000000060022370)

它直接指向此行,

. = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;

但是当将此行更改为:

. = . + bsp_vector_table_size;

没有错误时,链接器满足,系统异常正在工作。

我的问题是:这样的表达如何:

. = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;

以这样的方式进行评估,它试图将位置计数器向后移动?我确定bsp_vector_table_size是正数,我的实验证实了这一点。 。 =。 + 0也有效。这种兴趣是什么问题?

I am developing new RTEMS BSP and I am modifying linker scripts

I modified this linker script file

    .rwbarrier : ALIGN_WITH_INPUT {
        . = ALIGN (bsp_section_rwbarrier_align);
    } > REGION_DATA AT > REGION_DATA

    .vector : ALIGN_WITH_INPUT {
        bsp_section_vector_begin = .;
        . = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;
        bsp_section_vector_end = .;
    } > REGION_VECTOR AT > REGION_VECTOR

Lets suppose that we need to put .vector section in the middle of some memory region thus we need symbol bsp_section_vector_begin to be aligned to 128, so I added this one line:

    .vector : ALIGN_WITH_INPUT {
        . = ALIGN(128);
        bsp_section_vector_begin = .;

Now I get this error:

[build] linkcmds.base:xxx cannot move location counter backwards (from 0000000060022380 to 0000000060022370)

Which is pointing directly to this line

. = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;

But when changed this line to:

. = . + bsp_vector_table_size;

There is no error, linker is satisfied and system exceptions are working.

My question is: how can such an expression like this:

. = . + DEFINED (bsp_vector_table_in_start_section) ? 0 : bsp_vector_table_size;

evaluate in a such way it try to move location counter backward? I am sure bsp_vector_table_size is positive number, and my experiment confirmed it. . = . + 0 works as well. What is wrong with this espression?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文