[doc] added information about exports.inc
[marionette.git] / kernel / linker.ld
blob05844582c59735cd90263fe097aebd5267757ed9
1 ENTRY (_start)
2 OUTPUT_FORMAT(elf32-i386)
4 _phys_base = 0x00100000 ; /* physical base address of kernel (where GRUB will load us) */
5 _virt_base = 0xC0000000 ; /* virtual base address of kernel (where we will map ourself to) */
7 PHDRS {
8     /* this segment contains the code that runs at physical addresses, which
9        includes only the bootcode. flags: read + write + execute */
10     physical PT_LOAD FLAGS(7) ;
11     /* this segment contains the code that runs at virtual addresses, which
12        is almost everything. flags: read + write + execute */
13     virtual PT_LOAD FLAGS(7) ;
16 SECTIONS {
17     /* put the multiboot header at the very start of the image,
18        then the startup code. Link at physical addresses. */
19     .start _phys_base : AT(_phys_base) {
20         _text_start = . ;
21         KEEP(*(multiboot))
22         *(startup)
23         . = ALIGN(32) ;
24     } :physical
26     /* put all the normal code of the kernel in a section linked at
27        0xC0000000. Note that the multiboot header and startup code will
28        also get mapped, so this section will get linked at something
29        like 0xC0000129 */
30     .text . - _phys_base + _virt_base : AT( _phys_base + SIZEOF(.start) ) {
31         *(.text*)
32         . = ALIGN(32) ;
33     } :virtual
35     .rodata : {
36         *(.rodata*)
37         . = ALIGN(32) ;
38     } :virtual
40     modinit : {
41         _modinit_start = . ;
42         KEEP(*(modinit))
43         _modinit_end = . ;
44         . = ALIGN(32) ;
45     } :virtual
47     .data : {
48         *(.data*)
49         . = ALIGN(32) ;
50     } :virtual
52     .bss : {
53         *(.bss*)
54         *(COMMON)
55     } :virtual
57     _edata = ADDR(.bss) - _virt_base + _phys_base ;
58     _end = _edata + SIZEOF(.bss) ;
60     /DISCARD/ : {
61         *(.comment)
62         *(.eh_frame) /* eh_frame is not used */
63     }