GCC连接器使用说明文件力的象征是在特定的地址 [英] gcc linker description file force symbol to be at specific address

查看:188
本文介绍了GCC连接器使用说明文件力的象征是在特定的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对GCC连接器使用说明文件非常具体的问题。我有一个嵌入式项目,必须确保,主符号或主要标志的地址是present在一个特定的地址(ELF文件)。

I have a very specific question about the gcc linker description file. I have an embedded project and have to make sure, that the main symbol or the address of the main symbol is present at a specific address (Elf File).

究其原因是,我有上有一个引导程序的微控制器。启动后该引导程序应调用主程序。出于这个原因,我必须提供开机后跳转到的地址。

The reason is, that i have a microcontroller which has a bootloader on it. This bootloader should call the main routine after bootup. For that reason I have to provide the address to jump to after boot.

有没有使用连接器使用说明文件,以强制符号总是在桌子上或输入地址或可我甚至得到符号的地址以某种方式把它写回的具体位置的方法吗?

Is there a way using the linker description file to force a symbol to be always on top of the table or enter an address or can i even get the address of the symbol in some way to write it back to the specific location?

Thx提前。

推荐答案

当然,有一种方法。你最好的选择是使用一款只为你的函数:

Sure there is a way. Your best option is to use a section just for your function:

int start(void) __attribute__((section(".start")));

int start(void)
{
}

然后在链接脚本:

And then in the linker script:

SECTIONS
{
    . = 0x1234; // <---- put here your address
    .start : 
    {
        *(.start)
    }
}

或类似的东西(它已经,因为我使用了相当长的时间)。

Or something like that (it's been quite a long time since I used that).

这篇关于GCC连接器使用说明文件力的象征是在特定的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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