我正在从文本“Operating Systems from 0 to 1”中学习如何链接脚本,并且在文本中他们展示了一个使用关键字 PHDRS 的示例;
ENTRY(main);
PHDRS
{
headers PT_PHDR FILEHDR PHDRS;
code PT_LOAD FILEHDR;
}
SECTIONS /*top level command that declares a list of custom program sections, ld provides set of such instructions.*/
{
. = 0x10000; /* set location counter to address 0x10000, base address for subsequent commands */
.text : { *(.text) } :code /* final .text section begins at address 0x1000, combines all .text sections from obj files into one final*/
. = …Run Code Online (Sandbox Code Playgroud)