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 __executable_start = .; 32 .text (text_start_pa): AT(text_start_pa - KERNEL_VMA) 33 { 34 _text = .; 35 36 /* any files' .text */ 37 *(.text) 38 39 /* any files' .text.*, for example: rust .text._ZN* */ 40 *(.text.*) 41 42 _etext = .; 43 __etext = .; 44 } 45 . = ALIGN(32768); 46 data_start_pa = .; 47 .data (data_start_pa): AT(data_start_pa - KERNEL_VMA) 48 { 49 _data = .; 50 *(.data) 51 *(.data.*) 52 *(.got.plt) 53 *(.got) 54 _edata = .; 55 } 56 57 . = ALIGN(32768); 58 59 rodata_start_pa = .; 60 .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA) 61 { 62 _rodata = .; 63 *(.rodata) 64 *(.rodata.*) 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 *(.sbss) 82 *(.sbss.*) 83 _ebss = .; 84 } 85 86 eh_frame = .; 87 .eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA) 88 { 89 __eh_frame_hdr_start = .; 90 *(.eh_frame_hdr) 91 __eh_frame_hdr_end = .; 92 __eh_frame_start = .; 93 *(.eh_frame) 94 *(.rela.eh_frame) 95 __eh_frame_end = .; 96 } 97 98 _end = .; 99 100 /DISCARD/ : { 101 /* *(.eh_frame) */ 102 103 } 104} 105