| 1 | /** AMD64 linker script
|
|---|
| 2 | *
|
|---|
| 3 | * umapped section:
|
|---|
| 4 | * kernel text
|
|---|
| 5 | * kernel data
|
|---|
| 6 | * mapped section:
|
|---|
| 7 | * kernel text
|
|---|
| 8 | * kernel data
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | #include <arch/boot/boot.h>
|
|---|
| 12 | #include <arch/mm/page.h>
|
|---|
| 13 |
|
|---|
| 14 | ENTRY(multiboot_image_start)
|
|---|
| 15 |
|
|---|
| 16 | PHDRS {
|
|---|
| 17 | ap_boot PT_LOAD ;
|
|---|
| 18 | unmapped PT_LOAD ;
|
|---|
| 19 | mapped PT_LOAD ;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | SECTIONS {
|
|---|
| 23 | kernel_load_address = PA2KA(BOOT_OFFSET);
|
|---|
| 24 |
|
|---|
| 25 | . = AP_BOOT_OFFSET + SIZEOF_HEADERS;
|
|---|
| 26 |
|
|---|
| 27 | /* Must be first. */
|
|---|
| 28 | .multiboot : { *(.multiboot); } :ap_boot
|
|---|
| 29 |
|
|---|
| 30 | ap_bootstrap_start = .;
|
|---|
| 31 |
|
|---|
| 32 | .ap_bootstrap : {
|
|---|
| 33 | *(K_AP_TEXT_START);
|
|---|
| 34 | *(K_AP_DATA_START);
|
|---|
| 35 | } :ap_boot
|
|---|
| 36 |
|
|---|
| 37 | ap_bootstrap_end = .;
|
|---|
| 38 |
|
|---|
| 39 | . = BOOT_OFFSET + (ap_bootstrap_end & (PAGE_SIZE-1));
|
|---|
| 40 | unmapped_start = .;
|
|---|
| 41 |
|
|---|
| 42 | .unmapped : {
|
|---|
| 43 | *(K_TEXT_START);
|
|---|
| 44 | *(K_DATA_START);
|
|---|
| 45 | *(K_INI_PTLS);
|
|---|
| 46 | } :unmapped
|
|---|
| 47 |
|
|---|
| 48 | unmapped_file_end = .;
|
|---|
| 49 |
|
|---|
| 50 | .unmapped_bss : {
|
|---|
| 51 | *(.bootstack);
|
|---|
| 52 | *(K_BSS_START);
|
|---|
| 53 | } :unmapped
|
|---|
| 54 |
|
|---|
| 55 | unmapped_end = .;
|
|---|
| 56 | mapped_load_start = ALIGN(PAGE_SIZE) + (unmapped_file_end & (PAGE_SIZE-1));
|
|---|
| 57 |
|
|---|
| 58 | .mapped (PA2KA(mapped_load_start)): AT (mapped_load_start) {
|
|---|
| 59 | ktext_start = .;
|
|---|
| 60 | *(.text .text.*);
|
|---|
| 61 | ktext_end = .;
|
|---|
| 62 |
|
|---|
| 63 | kdata_start = .;
|
|---|
| 64 | *(.data); /* initialized data */
|
|---|
| 65 | *(.rodata .rodata.*); /* string literals */
|
|---|
| 66 | *(COMMON); /* global variables */
|
|---|
| 67 |
|
|---|
| 68 | /* bss can't be omitted from the ELF image. */
|
|---|
| 69 | *(.bss); /* uninitialized static variables */
|
|---|
| 70 |
|
|---|
| 71 | . = ALIGN(8);
|
|---|
| 72 | symbol_table = .;
|
|---|
| 73 | *(symtab.*); /* Symbol table, must be LAST symbol! */
|
|---|
| 74 | kdata_end = .;
|
|---|
| 75 | } :mapped
|
|---|
| 76 |
|
|---|
| 77 | #ifdef CONFIG_LINE_DEBUG
|
|---|
| 78 | .comment 0 : { *(.comment); }
|
|---|
| 79 | .debug_abbrev 0 : { *(.debug_abbrev); }
|
|---|
| 80 | .debug_aranges 0 : { *(.debug_aranges); }
|
|---|
| 81 | .debug_info 0 : { *(.debug_info); }
|
|---|
| 82 | .debug_line 0 : { *(.debug_line); }
|
|---|
| 83 | .debug_loc 0 : { *(.debug_loc); }
|
|---|
| 84 | .debug_pubnames 0 : { *(.debug_pubnames); }
|
|---|
| 85 | .debug_pubtypes 0 : { *(.debug_pubtypes); }
|
|---|
| 86 | .debug_ranges 0 : { *(.debug_ranges); }
|
|---|
| 87 | .debug_str 0 : { *(.debug_str); }
|
|---|
| 88 | #endif
|
|---|
| 89 |
|
|---|
| 90 | /DISCARD/ : {
|
|---|
| 91 | *(*);
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | #ifdef CONFIG_SMP
|
|---|
| 95 | protected_ap_gdtr = PA2KA(ap_gdtr);
|
|---|
| 96 | #endif /* CONFIG_SMP */
|
|---|
| 97 |
|
|---|
| 98 | }
|
|---|