|
|
1.1 ! root 1: /* -*- sh -*- */ ! 2: ! 3: /* ! 4: * Linker script for i386 images ! 5: * ! 6: */ ! 7: ! 8: OUTPUT_FORMAT ( "elf32-i386", "elf32-i386", "elf32-i386" ) ! 9: OUTPUT_ARCH ( i386 ) ! 10: ! 11: SECTIONS { ! 12: ! 13: /* All sections in the resulting file have consecutive load ! 14: * addresses, but may have individual link addresses depending on ! 15: * the memory model being used. ! 16: * ! 17: * The linker symbols _prefix_link_addr, load_addr, and ! 18: * _max_align may be specified explicitly. If not specified, they ! 19: * will default to: ! 20: * ! 21: * _prefix_link_addr = 0 ! 22: * _load_addr = 0 ! 23: * _max_align = 16 ! 24: * ! 25: * We guarantee alignment of virtual addresses to any alignment ! 26: * specified by the constituent object files (e.g. via ! 27: * __attribute__((aligned(x)))). Load addresses are guaranteed ! 28: * only up to _max_align. Provided that all loader and relocation ! 29: * code honours _max_align, this means that physical addresses are ! 30: * also guaranteed up to _max_align. ! 31: * ! 32: * Note that when using -DKEEP_IT_REAL, the UNDI segments are only ! 33: * guaranteed to be loaded on a paragraph boundary (i.e. 16-byte ! 34: * alignment). Using _max_align>16 will therefore not guarantee ! 35: * >16-byte alignment of physical addresses when -DKEEP_IT_REAL is ! 36: * used (though virtual addresses will still be fully aligned). ! 37: * ! 38: */ ! 39: ! 40: /* ! 41: * The prefix ! 42: */ ! 43: ! 44: _prefix_link_addr = DEFINED ( _prefix_link_addr ) ? _prefix_link_addr : 0; ! 45: . = _prefix_link_addr; ! 46: _prefix = .; ! 47: ! 48: .prefix : AT ( _prefix_load_offset + __prefix ) { ! 49: __prefix = .; ! 50: _entry = .; ! 51: *(.prefix) ! 52: *(.prefix.*) ! 53: _eprefix_progbits = .; ! 54: } ! 55: ! 56: _eprefix = .; ! 57: ! 58: /* ! 59: * The 16-bit sections ! 60: */ ! 61: ! 62: _text16_link_addr = 0; ! 63: . = _text16_link_addr; ! 64: _text16 = .; ! 65: ! 66: . += 1; /* Prevent NULL being valid */ ! 67: ! 68: .text16 : AT ( _text16_load_offset + __text16 ) { ! 69: __text16 = .; ! 70: KEEP(*(.text.null_trap)) ! 71: KEEP(*(.text.null_trap.*)) ! 72: *(.text16) ! 73: *(.text16.*) ! 74: *(.text) ! 75: *(.text.*) ! 76: _etext16_progbits = .; ! 77: } = 0x9090 ! 78: ! 79: _etext16 = .; ! 80: ! 81: _data16_link_addr = 0; ! 82: . = _data16_link_addr; ! 83: _data16 = .; ! 84: ! 85: . += 1; /* Prevent NULL being valid */ ! 86: ! 87: .rodata16 : AT ( _data16_load_offset + __rodata16 ) { ! 88: __rodata16 = .; ! 89: *(.rodata16) ! 90: *(.rodata16.*) ! 91: *(.rodata) ! 92: *(.rodata.*) ! 93: } ! 94: .data16 : AT ( _data16_load_offset + __data16 ) { ! 95: __data16 = .; ! 96: *(.data16) ! 97: *(.data16.*) ! 98: *(.data) ! 99: *(.data.*) ! 100: KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */ ! 101: _edata16_progbits = .; ! 102: } ! 103: .bss16 : AT ( _data16_load_offset + __bss16 ) { ! 104: __bss16 = .; ! 105: _bss16 = .; ! 106: *(.bss16) ! 107: *(.bss16.*) ! 108: *(.bss) ! 109: *(.bss.*) ! 110: *(COMMON) ! 111: _ebss16 = .; ! 112: } ! 113: .stack16 : AT ( _data16_load_offset + __stack16 ) { ! 114: __stack16 = .; ! 115: *(.stack16) ! 116: *(.stack16.*) ! 117: *(.stack) ! 118: *(.stack.*) ! 119: } ! 120: ! 121: _edata16 = .; ! 122: ! 123: _end = .; ! 124: ! 125: /* ! 126: * Dispose of the comment and note sections to make the link map ! 127: * easier to read ! 128: */ ! 129: ! 130: /DISCARD/ : { ! 131: *(.comment) ! 132: *(.comment.*) ! 133: *(.note) ! 134: *(.note.*) ! 135: *(.discard) ! 136: *(.discard.*) ! 137: } ! 138: ! 139: /* ! 140: * Load address calculations. The slightly obscure nature of the ! 141: * calculations is because ALIGN(x) can only operate on the ! 142: * location counter. ! 143: */ ! 144: ! 145: _max_align = DEFINED ( _max_align ) ? _max_align : 16; ! 146: _load_addr = DEFINED ( _load_addr ) ? _load_addr : 0; ! 147: ! 148: . = _load_addr; ! 149: ! 150: . -= _prefix_link_addr; ! 151: _prefix_load_offset = ALIGN ( _max_align ); ! 152: _prefix_load_addr = _prefix_link_addr + _prefix_load_offset; ! 153: _prefix_size = _eprefix - _prefix; ! 154: _prefix_progbits_size = _eprefix_progbits - _prefix; ! 155: . = _prefix_load_addr + _prefix_progbits_size; ! 156: ! 157: . -= _text16_link_addr; ! 158: _text16_load_offset = ALIGN ( _max_align ); ! 159: _text16_load_addr = _text16_link_addr + _text16_load_offset; ! 160: _text16_size = _etext16 - _text16; ! 161: _text16_progbits_size = _etext16_progbits - _text16; ! 162: . = _text16_load_addr + _text16_progbits_size; ! 163: ! 164: . -= _data16_link_addr; ! 165: _data16_load_offset = ALIGN ( _max_align ); ! 166: _data16_load_addr = _data16_link_addr + _data16_load_offset; ! 167: _data16_size = _edata16 - _data16; ! 168: _data16_progbits_size = _edata16_progbits - _data16; ! 169: . = _data16_load_addr + _data16_progbits_size; ! 170: ! 171: . = ALIGN ( _max_align ); ! 172: ! 173: _load_size = . - _load_addr; ! 174: ! 175: /* ! 176: * Alignment checks. ALIGN() can only operate on the location ! 177: * counter, so we set the location counter to each value we want ! 178: * to check. ! 179: */ ! 180: ! 181: . = _prefix_load_addr - _prefix_link_addr; ! 182: _assert = ASSERT ( ( . == ALIGN ( _max_align ) ), ! 183: "_prefix is badly aligned" ); ! 184: ! 185: . = _text16_load_addr - _text16_link_addr; ! 186: _assert = ASSERT ( ( . == ALIGN ( _max_align ) ), ! 187: "_text16 is badly aligned" ); ! 188: ! 189: . = _data16_load_addr - _data16_link_addr; ! 190: _assert = ASSERT ( ( . == ALIGN ( _max_align ) ), ! 191: "_data16 is badly aligned" ); ! 192: ! 193: /* ! 194: * Values calculated to save code from doing it ! 195: */ ! 196: _text16_size_pgh = ( ( _text16_size + 15 ) / 16 ); ! 197: _data16_size_pgh = ( ( _data16_size + 15 ) / 16 ); ! 198: _load_size_pgh = ( ( _load_size + 15 ) / 16 ); ! 199: _load_size_sect = ( ( _load_size + 511 ) / 512 ); ! 200: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.