[da585a52] | 1 | /** IA-32 linker script
|
---|
[6da1013f] | 2 | *
|
---|
[dcbc8be] | 3 | * umapped section:
|
---|
[6da1013f] | 4 | * kernel text
|
---|
| 5 | * kernel data
|
---|
[dcbc8be] | 6 | * mapped section:
|
---|
[6da1013f] | 7 | * kernel text
|
---|
| 8 | * kernel data
|
---|
[f761f1eb] | 9 | */
|
---|
| 10 |
|
---|
[1b492b5] | 11 | #include <arch/boot/boot.h>
|
---|
| 12 | #include <arch/mm/page.h>
|
---|
| 13 |
|
---|
[f761f1eb] | 14 | SECTIONS {
|
---|
[8a1afd2] | 15 | kernel_load_address = PA2KA(BOOT_OFFSET);
|
---|
| 16 |
|
---|
[15639ec] | 17 | .unmapped (BOOT_OFFSET + SIZEOF_HEADERS): AT (BOOT_OFFSET + SIZEOF_HEADERS) {
|
---|
[bae43dc] | 18 | unmapped_start = .;
|
---|
[c89ae25] | 19 | KEEP(*(K_TEXT_START));
|
---|
| 20 | KEEP(*(K_DATA_START));
|
---|
[bae43dc] | 21 | unmapped_end = .;
|
---|
[ac5d02b] | 22 | }
|
---|
[f1380b7] | 23 |
|
---|
[6677acb] | 24 | .text (PA2KA(BOOT_OFFSET) + SIZEOF_HEADERS + SIZEOF(.unmapped)): AT (BOOT_OFFSET + SIZEOF_HEADERS + SIZEOF(.unmapped)) {
|
---|
[ac5d02b] | 25 | ktext_start = .;
|
---|
[c81e5e0] | 26 | *(.text .text.*);
|
---|
[ac5d02b] | 27 | ktext_end = .;
|
---|
[6677acb] | 28 | }
|
---|
| 29 |
|
---|
| 30 | /* stack unwinding data */
|
---|
| 31 | .eh_frame_hdr : {
|
---|
| 32 | eh_frame_hdr_start = .;
|
---|
| 33 | *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
|
---|
| 34 | eh_frame_hdr_end = .;
|
---|
| 35 | }
|
---|
| 36 | .eh_frame : {
|
---|
| 37 | eh_frame_start = .;
|
---|
| 38 | KEEP(*(.eh_frame .eh_frame.*));
|
---|
| 39 | eh_frame_end = .;
|
---|
| 40 | }
|
---|
[f1380b7] | 41 |
|
---|
[6677acb] | 42 | .data : {
|
---|
[ac5d02b] | 43 | kdata_start = .;
|
---|
[6677acb] | 44 | *(.rodata .rodata.*); /* read-only global variables */
|
---|
| 45 | *(.data .data.*); /* non-zero initialized global variables */
|
---|
| 46 |
|
---|
| 47 | /*
|
---|
| 48 | * When .bss is not physically present in the ELF file (MemSz > FileSz)
|
---|
| 49 | * the kernel crashes during early boot. Not sure which part of the
|
---|
| 50 | * boot process is to blame, for now just keep .bss packaged with .data
|
---|
| 51 | * so that FileSz == MemSz.
|
---|
| 52 | */
|
---|
| 53 |
|
---|
| 54 | *(.bss .bss.*); /* uninitialized global variables */
|
---|
| 55 | *(COMMON); /* non-`static` global variables without an extern declaration */
|
---|
[ac5d02b] | 56 | kdata_end = .;
|
---|
| 57 | }
|
---|
[f1380b7] | 58 |
|
---|
[1e00216] | 59 | .comment 0 : { *(.comment); }
|
---|
| 60 | .debug_abbrev 0 : { *(.debug_abbrev); }
|
---|
[da13982] | 61 | .debug_abbrev.dwo 0 : { *( .debug_abbrev.dwo); }
|
---|
| 62 | .debug_addr 0 : { *(.debug_addr); }
|
---|
[1e00216] | 63 | .debug_aranges 0 : { *(.debug_aranges); }
|
---|
[da13982] | 64 | .debug_cu_index 0 : { *(.debug_cu_index); }
|
---|
| 65 | .debug_frame 0 : { *(.debug_frame); }
|
---|
| 66 | .debug_frame_hdr 0 : { *(.debug_frame_hdr); }
|
---|
[1e00216] | 67 | .debug_info 0 : { *(.debug_info); }
|
---|
[da13982] | 68 | .debug_info.dwo 0 : { *(.debug_info.dwo); }
|
---|
[1e00216] | 69 | .debug_line 0 : { *(.debug_line); }
|
---|
[da13982] | 70 | .debug_line.dwo 0 : { *(.debug_line.dwo); }
|
---|
| 71 | .debug_line_str 0 : { *(.debug_line_str); }
|
---|
[1e00216] | 72 | .debug_loc 0 : { *(.debug_loc); }
|
---|
[da13982] | 73 | .debug_loclists 0 : { *(.debug_loclists); }
|
---|
| 74 | .debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
|
---|
| 75 | .debug_macinfo 0 : { *(.debug_macinfo); }
|
---|
| 76 | .debug_macro 0 : { *(.debug_macro); }
|
---|
| 77 | .debug_macro.dwo 0 : { *(.debug_macro.dwo); }
|
---|
| 78 | .debug_names 0 : { *(.debug_names); }
|
---|
[1e00216] | 79 | .debug_pubnames 0 : { *(.debug_pubnames); }
|
---|
| 80 | .debug_pubtypes 0 : { *(.debug_pubtypes); }
|
---|
| 81 | .debug_ranges 0 : { *(.debug_ranges); }
|
---|
[da13982] | 82 | .debug_rnglists 0 : { *(.debug_rnglists); }
|
---|
[1e00216] | 83 | .debug_str 0 : { *(.debug_str); }
|
---|
[da13982] | 84 | .debug_str.dwo 0 : { *(.debug_str.dwo); }
|
---|
| 85 | .debug_str_offsets 0 : { *(.debug_str_offsets); }
|
---|
| 86 | .debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
|
---|
| 87 | .debug_tu_index 0 : { *(.debug_tu_index); }
|
---|
| 88 | .debug_types 0 : { *(.debug_types); }
|
---|
[f1380b7] | 89 |
|
---|
[941d1e9] | 90 | /DISCARD/ : {
|
---|
[1e00216] | 91 | *(*);
|
---|
[941d1e9] | 92 | }
|
---|
[f1380b7] | 93 |
|
---|
[6da1013f] | 94 | #ifdef CONFIG_SMP
|
---|
[f1380b7] | 95 |
|
---|
[66def8d] | 96 | ap_boot = unmapped_ap_boot - BOOT_OFFSET + AP_BOOT_OFFSET;
|
---|
| 97 | ap_gdtr = unmapped_ap_gdtr - BOOT_OFFSET + AP_BOOT_OFFSET;
|
---|
| 98 | protected_ap_gdtr = PA2KA(ap_gdtr);
|
---|
[f1380b7] | 99 |
|
---|
[66def8d] | 100 | #endif /* CONFIG_SMP */
|
---|
[f1380b7] | 101 |
|
---|
[f761f1eb] | 102 | }
|
---|