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 __executable_start = .; 30 .text (text_start_pa): AT(text_start_pa - KERNEL_VMA) 31 { 32 _text = .; 33 34 /* any files' .text */ 35 *(.text) 36 37 /* any files' .text.*, for example: rust .text._ZN* */ 38 *(.text.*) 39 40 _etext = .; 41 __etext = .; 42 } 43 . = ALIGN(32768); 44 data_start_pa = .; 45 .data (data_start_pa): AT(data_start_pa - KERNEL_VMA) 46 { 47 _data = .; 48 *(.data) 49 *(.data.*) 50 51 _edata = .; 52 } 53 54 . = ALIGN(32768); 55 56 rodata_start_pa = .; 57 .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA) 58 { 59 _rodata = .; 60 *(.rodata) 61 *(.rodata.*) 62 *(.note.gnu.*) 63 *(.fixup) 64 *(.gcc_except_table .gcc_except_table.*) 65 _erodata = .; 66 } 67 68 . = ALIGN(32768); 69 70 init_proc_union_start_pa = .; 71 .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) 72 { *(.data.init_proc_union) } 73 74 . = ALIGN(32768); 75 bss_start_pa = .; 76 .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA) 77 { 78 _bss = .; 79 *(.bss) 80 *(.bss.*) 81 _ebss = .; 82 } 83 84 eh_frame = .; 85 .eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA) 86 { 87 __eh_frame_hdr_start = .; 88 *(.eh_frame_hdr) 89 __eh_frame_hdr_end = .; 90 __eh_frame_start = .; 91 *(.eh_frame) 92 *(.rela.eh_frame) 93 __eh_frame_end = .; 94 } 95 96 _end = .; 97 98 /DISCARD/ : { 99 /* *(.eh_frame) */ 100 101 } 102} 103