Whole document tree
    

Whole document tree

Untitled Document: Entry Point
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.6 The Entry Point

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:
 
ENTRY(symbol)

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 0.

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---

 
start = 0x2020;

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:

 
start = other_symbol ;



This document was generated by root on January, 30 2002 using texi2html