|
| 1 | +/* |
| 2 | + * Linker script for ROM16 binaries |
| 3 | + */ |
| 4 | + |
| 5 | +/* Script for -z combreloc: combine and sort reloc sections */ |
| 6 | +OUTPUT_FORMAT("elf32-i386", "elf32-i386", |
| 7 | + "elf32-i386") |
| 8 | +OUTPUT_ARCH(i386) |
| 9 | +EXTERN(_start) |
| 10 | +ENTRY(_start) |
| 11 | +SECTIONS |
| 12 | +{ |
| 13 | + /* Read-only sections, merged into text segment: */ |
| 14 | + . = 0x0; |
| 15 | + PROVIDE (__executable_start = .); |
| 16 | + |
| 17 | + .init : |
| 18 | + { |
| 19 | + KEEP (*(.init)) |
| 20 | + } =0x90909090 |
| 21 | + .text : |
| 22 | + { |
| 23 | + *(.text .stub .text.* .gnu.linkonce.t.*) |
| 24 | + /* .gnu.warning sections are handled specially by elf32.em. */ |
| 25 | + *(.gnu.warning) |
| 26 | + } =0x90909090 |
| 27 | + .fini : |
| 28 | + { |
| 29 | + KEEP (*(.fini)) |
| 30 | + } =0x90909090 |
| 31 | + PROVIDE (__etext = .); |
| 32 | + PROVIDE (_etext = .); |
| 33 | + PROVIDE (etext = .); |
| 34 | + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
| 35 | + .rodata1 : { *(.rodata1) } |
| 36 | + |
| 37 | + /* Ensure the __preinit_array_start label is properly aligned. We |
| 38 | + could instead move the label definition inside the section, but |
| 39 | + the linker would then create the section even if it turns out to |
| 40 | + be empty, which isn't pretty. */ |
| 41 | + . = ALIGN(4); |
| 42 | + PROVIDE (__preinit_array_start = .); |
| 43 | + .preinit_array : { *(.preinit_array) } |
| 44 | + PROVIDE (__preinit_array_end = .); |
| 45 | + PROVIDE (__init_array_start = .); |
| 46 | + .init_array : { *(.init_array) } |
| 47 | + PROVIDE (__init_array_end = .); |
| 48 | + PROVIDE (__fini_array_start = .); |
| 49 | + .fini_array : { *(.fini_array) } |
| 50 | + PROVIDE (__fini_array_end = .); |
| 51 | + PROVIDE (__ctors_start = .); |
| 52 | + .ctors : |
| 53 | + { |
| 54 | + KEEP (*(SORT(.ctors.*))) |
| 55 | + KEEP (*(.ctors)) |
| 56 | + } |
| 57 | + PROVIDE (__ctors_end = .); |
| 58 | + PROVIDE (__dtors_start = .); |
| 59 | + .dtors : |
| 60 | + { |
| 61 | + KEEP (*(SORT(.dtors.*))) |
| 62 | + KEEP (*(.dtors)) |
| 63 | + } |
| 64 | + PROVIDE (__dtors_end = .); |
| 65 | + |
| 66 | + /* Adjust the address for the data segment. Avoid mixing code and |
| 67 | + data within same 128-byte chunk. */ |
| 68 | + . = ALIGN(128); |
| 69 | + |
| 70 | + .data : |
| 71 | + { |
| 72 | + *(.data .data.* .gnu.linkonce.d.*) |
| 73 | + SORT(CONSTRUCTORS) |
| 74 | + } |
| 75 | + .data1 : { *(.data1) } |
| 76 | + _edata = .; |
| 77 | + PROVIDE (edata = .); |
| 78 | + __bss_start = .; |
| 79 | + .bss : |
| 80 | + { |
| 81 | + *(.dynbss) |
| 82 | + *(.bss .bss.* .gnu.linkonce.b.*) |
| 83 | + *(COMMON) |
| 84 | + /* Align here to ensure that the .bss section occupies space up to |
| 85 | + _end. Align after .bss to ensure correct alignment even if the |
| 86 | + .bss section disappears because there are no input sections. */ |
| 87 | + . = ALIGN(32 / 8); |
| 88 | + } |
| 89 | + .csum : |
| 90 | + { |
| 91 | + . = ALIGN(2048) - 5; |
| 92 | + LONG(0xff4c494e); |
| 93 | + /* BYTE(_rom_size_byte); */ |
| 94 | + } =0xffffffff |
| 95 | + _end = .; |
| 96 | + PROVIDE (end = .); |
| 97 | + PROVIDE(_rom_size_byte = (511 + end) / 512); |
| 98 | + |
| 99 | + /* Stabs debugging sections. */ |
| 100 | + .stab 0 : { *(.stab) } |
| 101 | + .stabstr 0 : { *(.stabstr) } |
| 102 | + .stab.excl 0 : { *(.stab.excl) } |
| 103 | + .stab.exclstr 0 : { *(.stab.exclstr) } |
| 104 | + .stab.index 0 : { *(.stab.index) } |
| 105 | + .stab.indexstr 0 : { *(.stab.indexstr) } |
| 106 | + .comment 0 : { *(.comment) } |
| 107 | + /* DWARF debug sections. |
| 108 | + Symbols in the DWARF debugging sections are relative to the beginning |
| 109 | + of the section so we begin them at 0. */ |
| 110 | + /* DWARF 1 */ |
| 111 | + .debug 0 : { *(.debug) } |
| 112 | + .line 0 : { *(.line) } |
| 113 | + /* GNU DWARF 1 extensions */ |
| 114 | + .debug_srcinfo 0 : { *(.debug_srcinfo) } |
| 115 | + .debug_sfnames 0 : { *(.debug_sfnames) } |
| 116 | + /* DWARF 1.1 and DWARF 2 */ |
| 117 | + .debug_aranges 0 : { *(.debug_aranges) } |
| 118 | + .debug_pubnames 0 : { *(.debug_pubnames) } |
| 119 | + /* DWARF 2 */ |
| 120 | + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
| 121 | + .debug_abbrev 0 : { *(.debug_abbrev) } |
| 122 | + .debug_line 0 : { *(.debug_line) } |
| 123 | + .debug_frame 0 : { *(.debug_frame) } |
| 124 | + .debug_str 0 : { *(.debug_str) } |
| 125 | + .debug_loc 0 : { *(.debug_loc) } |
| 126 | + .debug_macinfo 0 : { *(.debug_macinfo) } |
| 127 | + /* SGI/MIPS DWARF 2 extensions */ |
| 128 | + .debug_weaknames 0 : { *(.debug_weaknames) } |
| 129 | + .debug_funcnames 0 : { *(.debug_funcnames) } |
| 130 | + .debug_typenames 0 : { *(.debug_typenames) } |
| 131 | + .debug_varnames 0 : { *(.debug_varnames) } |
| 132 | + /DISCARD/ : { *(.note.GNU-stack) } |
| 133 | +} |
0 commit comments