1OUTPUT_FORMAT( 2 "elf64-littleriscv", 3 "elf64-littleriscv", 4 "elf64-littleriscv" 5) 6 7OUTPUT_ARCH(riscv) 8ENTRY(_start) 9 10 11SECTIONS 12{ 13 //KERNEL_VMA = 0xffffffc000000000; 14 KERNEL_VMA = 0; 15 . = 0; 16 17 .boot.text : 18 { 19 KEEP(*(.multiboot_header)) 20 *(.bootstrap) 21 *(.bootstrap.code64) 22 *(.bootstrap.data) 23 . = ALIGN(4096); 24 } 25 26 . += KERNEL_VMA; 27 . = ALIGN(32768); 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 _erodata = .; 61 } 62 63 . = ALIGN(32768); 64 65 init_proc_union_start_pa = .; 66 .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) 67 { *(.data.init_proc_union) } 68 69 . = ALIGN(32768); 70 bss_start_pa = .; 71 .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA) 72 { 73 _bss = .; 74 *(.bss) 75 *(.bss.*) 76 _ebss = .; 77 } 78 79 eh_frame = .; 80 .eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA) 81 { 82 __eh_frame_hdr_start = .; 83 *(.eh_frame_hdr) 84 __eh_frame_hdr_end = .; 85 __eh_frame_start = .; 86 *(.eh_frame) 87 *(.rela.eh_frame) 88 __eh_frame_end = .; 89 } 90 91 _end = .; 92 93 /DISCARD/ : { 94 /* *(.eh_frame) */ 95 96 } 97} 98