XGC User's Guide: Using the Assembler Linker and Utilities | ||
---|---|---|
Prev | Chapter 11. Linker Command Language | Next |
The linker command language includes a command specifically for defining the first executable instruction in an output file (its entry point). Its argument is a symbol name:
Like symbol assignments, the ENTRY command may be placed either as an independent command in the command file, or among the section definitions within the SECTIONS command—whatever makes the most sense for your layout.
ENTRY is only one of several ways of choosing the entry point. You may indicate it in any of the following ways (shown in descending order of priority: methods higher in the list override methods lower down).
the -e entry command-line option;
the ENTRY(symbol) command in a linker control script;
the value of the symbol start, if present;
the address of the first byte of the .text section, if present;
The address 0x00000000.
For example, you can use these rules to generate an entry point with an assignment statement: if no symbol start is defined within your input files, you can simply define it, assigning it an appropriate value:
The example shows an absolute address, but you can use any expression. For example, if your input object files use some other symbol-name convention for the entry point, you can just assign the value of whatever symbol contains the start address to start: