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 13 .boot.text : 14 { 15 KEEP(*(.multiboot_header)) 16 KEEP(*(.multiboot2_header)) 17 *(.bootstrap) 18 *(.bootstrap.code64) 19 *(.bootstrap.data) 20 . = ALIGN(4096); 21 } 22 23 . = 0x1000000; 24 . += KERNEL_VMA; 25 . = ALIGN(32768); 26 text_start_pa = .; 27 .text (text_start_pa): AT(text_start_pa - KERNEL_VMA) 28 { 29 _text = .; 30 31 /* any files' .text */ 32 *(.text) 33 34 /* any files' .text.*, for example: rust .text._ZN* */ 35 *(.text.*) 36 37 _etext = .; 38 } 39 . = ALIGN(32768); 40 data_start_pa = .; 41 .data (data_start_pa): AT(data_start_pa - KERNEL_VMA) 42 { 43 _data = .; 44 *(.data) 45 *(.data.*) 46 47 _edata = .; 48 } 49 50 . = ALIGN(32768); 51 52 rodata_start_pa = .; 53 .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA) 54 { 55 _rodata = .; 56 *(.rodata) 57 *(.rodata.*) 58 _erodata = .; 59 } 60 61 . = ALIGN(32768); 62 63 init_proc_union_start_pa = .; 64 .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) 65 { *(.data.init_proc_union) } 66 67 . = ALIGN(32768); 68 bss_start_pa = .; 69 .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA) 70 { 71 _bss = .; 72 *(.bss) 73 *(.bss.*) 74 _ebss = .; 75 } 76 77 eh_frame = .; 78 .eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA) 79 { 80 __eh_frame_hdr_start = .; 81 *(.eh_frame_hdr) 82 __eh_frame_hdr_end = .; 83 __eh_frame_start = .; 84 *(.eh_frame) 85 *(.rela.eh_frame) 86 __eh_frame_end = .; 87 } 88 89 _end = .; 90 91 /DISCARD/ : { 92 /* *(.eh_frame) */ 93 94 } 95} 96