What does “ENTRY” mean in a linker script?

一个人想着一个人 提交于 2019-12-11 01:24:12

问题


I am beginning to learn to write some low-level software for micro-controllers, and I've started studying linker scripts.

I don't really get the meaning of the ENTRY command in this context. Since most micro-controllers start execution at a predetermined address, what difference does it make which entry point we choose in the linker script?


回答1:


ENTRY() is an ELF feature that basically just sets the program entry address in the ELF header of your executable. This address may differ from the start address of the first executable segment of your binary (which would be the default execution address if you didn't define ENTRY()).

Whether this information is used (i.e. whether start of execution happens at the first code segment address or at ENTRY()) is out of control of the linker as it entirely depends on the availability and features of your ELF loader.

As you usually do not have such thing on a microcontroller, ENTRY() is practically useless there and you might as well omit the statement at no consequence.




回答2:


The entry point defines the starting point of your program. This is of course very good information to have. This way flash tools know where to flash your code and also debug tools know where your symbols are at.



来源:https://stackoverflow.com/questions/40606700/what-does-entry-mean-in-a-linker-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!