| 1 | OUTPUT_FORMAT(elf32-i386) |
| 2 | ENTRY(_start) |
| 3 | |
| 4 | PHDRS |
| 5 | { |
| 6 | text_s2 PT_LOAD FLAGS(0x05); |
| 7 | rodata_s2 PT_LOAD FLAGS(0x04); |
| 8 | data_s2 PT_LOAD FLAGS(0x06); |
| 9 | text_s3 PT_LOAD FLAGS(0x05); |
| 10 | rodata_s3 PT_LOAD FLAGS(0x04); |
| 11 | data_s3 PT_LOAD FLAGS(0x06); |
| 12 | } |
| 13 | |
| 14 | SECTIONS |
| 15 | { |
| 16 | . = 0xf000; |
| 17 | |
| 18 | .text.stage2 : { |
| 19 | *(.entry) |
| 20 | *(.realmode) |
| 21 | *.s2.o(.text .text.*) |
| 22 | } :text_s2 |
| 23 | |
| 24 | .rodata.stage2 : { |
| 25 | *.s2.o(.rodata .rodata.*) |
| 26 | |
| 27 | build_id_s2 = .; |
| 28 | KEEP(*build-id.s2.o(*)) |
| 29 | |
| 30 | #ifdef LINKER_STAGE2ONLY |
| 31 | /* stage2 missing symbols overrides */ |
| 32 | stage2_map = .; |
| 33 | stage3_common = .; |
| 34 | build_id_s3 = .; |
| 35 | full_map = .; |
| 36 | getchar = .; |
| 37 | menu = .; |
| 38 | booting_from_editor = .; |
| 39 | flanterm_write = .; |
| 40 | term_backend = .; |
| 41 | term_fallback = .; |
| 42 | term_notready = .; |
| 43 | terms = .; |
| 44 | terms_i = .; |
| 45 | usec_at_bootloader_entry = .; |
| 46 | serial_out = .; |
| 47 | stage3_addr = .; |
| 48 | #else |
| 49 | #ifdef LINKER_NOS2MAP |
| 50 | stage2_map = .; |
| 51 | #else |
| 52 | *(.stage2_map) |
| 53 | #endif |
| 54 | #endif |
| 55 | } :rodata_s2 |
| 56 | |
| 57 | .data.stage2 : { |
| 58 | s2_data_begin = .; |
| 59 | *.s2.o(.data .data.*) |
| 60 | s2_data_end = .; |
| 61 | } :data_s2 |
| 62 | |
| 63 | .no_unwind.stage2 : { |
| 64 | *.s2.o(.no_unwind) |
| 65 | } :data_s2 |
| 66 | |
| 67 | #ifndef LINKER_STAGE2ONLY |
| 68 | .text.stage3 : { |
| 69 | stage3_addr = .; |
| 70 | *(.text .text.*) |
| 71 | } :text_s3 |
| 72 | |
| 73 | .rodata.stage3 : { |
| 74 | *(.rodata .rodata.*) |
| 75 | |
| 76 | build_id_s3 = .; |
| 77 | KEEP(*build-id.s3.o(*)) |
| 78 | |
| 79 | #ifdef LINKER_NOMAP |
| 80 | full_map = .; |
| 81 | #else |
| 82 | *(.full_map) |
| 83 | #endif |
| 84 | } :rodata_s3 |
| 85 | |
| 86 | .data.stage3 : { |
| 87 | data_begin = .; |
| 88 | *(.data .data.*) |
| 89 | data_end = .; |
| 90 | } :data_s3 |
| 91 | |
| 92 | .no_unwind.stage3 : { |
| 93 | *(.no_unwind) |
| 94 | } :data_s3 |
| 95 | #endif |
| 96 | |
| 97 | .note.gnu.build-id : { |
| 98 | *(.note.gnu.build-id) |
| 99 | limine_bios_sys_size = . - 0xf000; |
| 100 | } :data_s3 |
| 101 | |
| 102 | .bss : { |
| 103 | bss_begin = .; |
| 104 | *(.bss .bss.*) |
| 105 | *(COMMON) |
| 106 | bss_end = .; |
| 107 | } :data_s3 |
| 108 | |
| 109 | /DISCARD/ : { |
| 110 | *(.eh_frame*) |
| 111 | *(.note .note.*) |
| 112 | } |
| 113 | } |