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