source: mainline/kernel/arch/mips32/_link.ld.in@ 2fff3c4

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 2fff3c4 was cfdeedc, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 7 years ago

Keep kernel in ELF format

By keeping kernel in an ELF file (instead of converting it to
a flat binary), we can use the information it contains, like
symbol table and debug info.

We can also later implement more advanced functionality, like
loading kernel at multiple discontiguous blocks, or loading
a position-independent kernel at a randomized address.

Currently the functionality is quite restricted, to keep changes
to a minimum. Code in boot/generic/src/kernel.c validates that
the kernel image was built with the same addresses as the boot
loader uses, giving an extra level of sanity checking compared
to a flat binary.

  • Property mode set to 100644
File size: 965 bytes
Line 
1/*
2 * MIPS32 linker script
3 *
4 * kernel text
5 * kernel data
6 *
7 */
8
9#undef mips
10#define mips mips
11
12#if defined(MACHINE_msim)
13#define KERNEL_LOAD_ADDRESS 0x80100000
14#endif
15
16#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
17#define KERNEL_LOAD_ADDRESS 0x80200000
18#endif
19
20OUTPUT_ARCH(mips)
21ENTRY(kernel_image_start)
22
23SECTIONS {
24 . = KERNEL_LOAD_ADDRESS;
25 kernel_load_address = .;
26 . = . + SIZEOF_HEADERS;
27
28 .text : {
29 ktext_start = .;
30 *(.text);
31 ktext_end = .;
32 }
33 .data : {
34 kdata_start = .;
35 *(.data); /* initialized data */
36 *(.rodata*);
37 *(.sdata);
38 *(.reginfo);
39 *(.sbss);
40 *(.scommon);
41 *(.bss); /* uninitialized static variables */
42 *(COMMON); /* global variables */
43 . = ALIGN(8);
44 symbol_table = .;
45 *(symtab.*);
46 }
47 _gp = . + 0x8000;
48 .lit8 : { *(.lit8) }
49 .lit4 : { *(.lit4) }
50
51 kdata_end = .;
52
53 /DISCARD/ : {
54 *(.mdebug*);
55 *(.pdr);
56 *(.comment);
57 *(.note);
58 }
59}
Note: See TracBrowser for help on using the repository browser.