1 2OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64") 3OUTPUT_ARCH(i386:x86-64) 4ENTRY(_start) 5 6SECTIONS 7{ 8 KERNEL_VMA = 0xffff800000000000; 9 //KERNEL_VMA = 0; 10 . = 0; 11 . = 0x100000; 12 _default_kernel_load_base = .; 13 .boot.text : 14 { 15 KEEP(*(.multiboot_header)) 16 KEEP(*(.multiboot2_header)) 17 18 *(.bootstrap) 19 *(.bootstrap.code64) 20 *(.bootstrap.data) 21 22 . = ALIGN(4096); 23 } 24 25 26 . = ALIGN(32768); 27 . += KERNEL_VMA; 28 text_start_pa = .; 29 .text (text_start_pa): AT(text_start_pa - KERNEL_VMA) 30 { 31 _text = .; 32 33 /* any files' .text */ 34 *(.text) 35 36 /* any files' .text.*, for example: rust .text._ZN* */ 37 *(.text.*) 38 39 _etext = .; 40 } 41 . = ALIGN(32768); 42 data_start_pa = .; 43 .data (data_start_pa): AT(data_start_pa - KERNEL_VMA) 44 { 45 _data = .; 46 *(.data) 47 *(.data.*) 48 49 _edata = .; 50 } 51 52 . = ALIGN(32768); 53 54 rodata_start_pa = .; 55 .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA) 56 { 57 _rodata = .; 58 *(.rodata) 59 *(.rodata.*) 60 *(.note.gnu.*) 61 *(.fixup) 62 _erodata = .; 63 } 64 65 . = ALIGN(32768); 66 67 init_proc_union_start_pa = .; 68 .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) 69 { *(.data.init_proc_union) } 70 71 . = ALIGN(32768); 72 bss_start_pa = .; 73 .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA) 74 { 75 _bss = .; 76 *(.bss) 77 *(.bss.*) 78 _ebss = .; 79 } 80 81 eh_frame = .; 82 .eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA) 83 { 84 __eh_frame_hdr_start = .; 85 *(.eh_frame_hdr) 86 __eh_frame_hdr_end = .; 87 __eh_frame_start = .; 88 *(.eh_frame) 89 *(.rela.eh_frame) 90 __eh_frame_end = .; 91 } 92 93 _end = .; 94 95 /DISCARD/ : { 96 /* *(.eh_frame) */ 97 98 } 99} 100