Entry Point (LD) (original) (raw)
3.4.1 Setting the Entry Point ¶
The first instruction to execute in a program is called the entry point. You can use the ENTRY
linker script command to set the entry point. The argument is a symbol name:
There are several ways to set the entry point. The linker will set the entry point by trying each of the following methods in order, and stopping when one of them succeeds:
- the ‘-e’ entry command-line option;
- the
ENTRY(symbol)
command in a linker script; - the value of a target-specific symbol, if it is defined; For many targets this is
start
, but PE- and BeOS-based systems for example check a list of possible entry symbols, matching the first one found. - the address of the first byte of the code section, if present and an executable is being created - the code section is usually ‘.text’, but can be something else;
- The address
0
.