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