Mercurial > hg-old > index.cgi
view lwlink/trunk/doc/scripts.txt @ 125:f9bfc2986023
Actually allow script file to be specified and fix segfault on parsing script file
author | lost |
---|---|
date | Fri, 23 Jan 2009 04:53:01 +0000 |
parents | 2ece9adb4e4b |
children |
line wrap: on
line source
LWLINK linker scripts A linker script is used to instruct the linker about how to assemble the various sections into a completed binary. It consists of a series of directives which are considered in the order they are encountered. Any section not referenced by a directive is assumed to be loaded after the final section explicitly referenced. The sections will appear in the resulting binary in the order they are specified in the script file. If a referenced section is not found, the linker will behave as though the section did exist but had a zero size, no relocations, and no exports. A section may only be referenced once. Any subsequent references will have no effect. All numbers are hexadecimal. section <name> load <addr> This causes the section <name> to load at <addr>. For raw target, only one "load at" entry is allowed for non-bss sections and it must be the first one. For raw targets, it affects the addresses the linker assigns to symbols but has no other affect on the output. bss sections may all have separate load addresses but since they will not appear in the binary anyway, this is okay. For the DECB target, each "load" entry will cause a new "block" to be output to the binary which will contain the load address. It is legal for sections to overlap in this manner - the linker assumes the loader will sort everything out. section <name> This will cause the section <name> to load after the previously listed section. exec <addr or sym> This will cause the execution address (entry point) to be the address specified (in hex) *or* the specified symbol name. The symbol name must match a symbol that is exported by one of the object files being linked. This has no effect for targets that do not encode the entry point into the resulting file. If not specified, the entry point is assumed to be address 0 which is probably not what you want. The default link scripts for targets that support this directive automatically starts at the beginning of the first section (usually "init" or "code") that is emitted in the binary. pad <size> This will cause the output file to be padded with NUL bytes to be exactly <size> bytes in length. This only makes sense for a raw target. If <name> is "*", then any section not already matched by the script will be matched. For format *,<flags> can be used to select sections which have particular flags set (or not set). For instance: *,!bss This would match all sections that do not have the bss flag set *,bss this would match all sections that do have the bss flag set