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 *(.gcc_except_table .gcc_except_table.*) 66 _erodata = .; 67 } 68 69 . = ALIGN(32768); 70 71 init_proc_union_start_pa = .; 72 .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) 73 { *(.data.init_proc_union) } 74 75 . = ALIGN(32768); 76 bss_start_pa = .; 77 .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA) 78 { 79 _bss = .; 80 *(.bss) 81 *(.bss.*) 82 *(.sbss) 83 *(.sbss.*) 84 _ebss = .; 85 } 86 87 eh_frame = .; 88 .eh_frame (eh_frame): AT(eh_frame - KERNEL_VMA) 89 { 90 __eh_frame_hdr_start = .; 91 *(.eh_frame_hdr) 92 __eh_frame_hdr_end = .; 93 __eh_frame_start = .; 94 *(.eh_frame) 95 *(.rela.eh_frame) 96 __eh_frame_end = .; 97 } 98 99 _end = .; 100 101 /DISCARD/ : { 102 /* *(.eh_frame) */ 103 104 } 105} 106