|
|
1.1 ! root 1: /* -*- sh -*- */ ! 2: ! 3: /* ! 4: * Linker script for i386 images ! 5: * ! 6: */ ! 7: ! 8: SECTIONS { ! 9: ! 10: /* Each section starts at a virtual address of zero. ! 11: * ! 12: * We guarantee alignment of virtual addresses to any alignment ! 13: * specified by the constituent object files (e.g. via ! 14: * __attribute__((aligned(x)))). Load addresses are guaranteed ! 15: * only up to _max_align. Provided that all loader and relocation ! 16: * code honours _max_align, this means that physical addresses are ! 17: * also guaranteed up to _max_align. ! 18: * ! 19: * Note that when using -DKEEP_IT_REAL, the UNDI segments are only ! 20: * guaranteed to be loaded on a paragraph boundary (i.e. 16-byte ! 21: * alignment). Using _max_align>16 will therefore not guarantee ! 22: * >16-byte alignment of physical addresses when -DKEEP_IT_REAL is ! 23: * used (though virtual addresses will still be fully aligned). ! 24: * ! 25: */ ! 26: ! 27: PROVIDE ( _max_align = 16 ); ! 28: ! 29: /* ! 30: * The prefix ! 31: * ! 32: */ ! 33: ! 34: .prefix 0x0 : AT ( _prefix_lma ) { ! 35: _prefix = .; ! 36: *(.prefix) ! 37: *(.prefix.*) ! 38: _mprefix = .; ! 39: } .bss.prefix (NOLOAD) : AT ( _end_lma ) { ! 40: _eprefix = .; ! 41: } ! 42: _prefix_filesz = ABSOLUTE ( _mprefix - _prefix ); ! 43: _prefix_memsz = ABSOLUTE ( _eprefix - _prefix ); ! 44: ! 45: /* ! 46: * The 16-bit (real-mode) code section ! 47: * ! 48: */ ! 49: ! 50: .text16.early 0x0 : AT ( _text16_early_lma ) { ! 51: _text16 = .; ! 52: KEEP(*(.text16.null)) ! 53: KEEP(*(.text16.null.*)) ! 54: . += 1; /* Prevent NULL being valid */ ! 55: *(.text16.early) ! 56: *(.text16.early.*) ! 57: _etext16_early = .; ! 58: } .text16.late ALIGN ( _max_align ) : AT ( _text16_late_lma ) { ! 59: _text16_late = .; ! 60: *(.text16) ! 61: *(.text16.*) ! 62: _mtext16 = .; ! 63: } .bss.text16 (NOLOAD) : AT ( _end_lma ) { ! 64: _etext16 = .; ! 65: } ! 66: _text16_early_filesz = ABSOLUTE ( _etext16_early - _text16 ); ! 67: _text16_early_memsz = ABSOLUTE ( _etext16_early - _text16 ); ! 68: _text16_late_filesz = ABSOLUTE ( _mtext16 - _text16_late ); ! 69: _text16_late_memsz = ABSOLUTE ( _etext16 - _text16_late ); ! 70: _text16_memsz = ABSOLUTE ( _etext16 - _text16 ); ! 71: ! 72: /* ! 73: * The 16-bit (real-mode) data section ! 74: * ! 75: */ ! 76: ! 77: .data16 0x0 : AT ( _data16_lma ) { ! 78: _data16 = .; ! 79: . += 1; /* Prevent NULL being valid */ ! 80: *(.rodata16) ! 81: *(.rodata16.*) ! 82: *(.data16) ! 83: *(.data16.*) ! 84: _mdata16 = .; ! 85: } .bss.data16 (NOLOAD) : AT ( _end_lma ) { ! 86: *(.bss16) ! 87: *(.bss16.*) ! 88: *(.stack16) ! 89: *(.stack16.*) ! 90: _edata16 = .; ! 91: } ! 92: _data16_filesz = ABSOLUTE ( _mdata16 - _data16 ); ! 93: _data16_memsz = ABSOLUTE ( _edata16 - _data16 ); ! 94: ! 95: /* ! 96: * The 32-bit sections ! 97: * ! 98: */ ! 99: ! 100: .textdata 0x0 : AT ( _textdata_lma ) { ! 101: _textdata = .; ! 102: KEEP(*(.text.null_trap)) ! 103: KEEP(*(.text.null_trap.*)) ! 104: . += 1; /* Prevent NULL being valid */ ! 105: *(.text) ! 106: *(.text.*) ! 107: *(.rodata) ! 108: *(.rodata.*) ! 109: *(.data) ! 110: *(.data.*) ! 111: KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */ ! 112: _mtextdata = .; ! 113: } .bss.textdata (NOLOAD) : AT ( _end_lma ) { ! 114: *(.bss) ! 115: *(.bss.*) ! 116: *(COMMON) ! 117: *(.stack) ! 118: *(.stack.*) ! 119: _etextdata = .; ! 120: } ! 121: _textdata_filesz = ABSOLUTE ( _mtextdata - _textdata ); ! 122: _textdata_memsz = ABSOLUTE ( _etextdata - _textdata ); ! 123: ! 124: /* ! 125: * Compressor information block ! 126: * ! 127: */ ! 128: ! 129: .zinfo 0x0 : AT ( _zinfo_lma ) { ! 130: _zinfo = .; ! 131: KEEP(*(.zinfo)) ! 132: KEEP(*(.zinfo.*)) ! 133: _mzinfo = .; ! 134: } .bss.zinfo (NOLOAD) : AT ( _end_lma ) { ! 135: _ezinfo = .; ! 136: } ! 137: _zinfo_filesz = ABSOLUTE ( _mzinfo - _zinfo ); ! 138: _zinfo_memsz = ABSOLUTE ( _ezinfo - _zinfo ); ! 139: ! 140: /* ! 141: * Weak symbols that need zero values if not otherwise defined ! 142: * ! 143: */ ! 144: ! 145: .weak 0x0 : AT ( _end_lma ) { ! 146: _weak = .; ! 147: *(.weak) ! 148: *(.weak.*) ! 149: _eweak = .; ! 150: } ! 151: _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" ); ! 152: ! 153: /* ! 154: * Dispose of the comment and note sections to make the link map ! 155: * easier to read ! 156: * ! 157: */ ! 158: ! 159: /DISCARD/ : { ! 160: *(.comment) ! 161: *(.comment.*) ! 162: *(.note) ! 163: *(.note.*) ! 164: *(.eh_frame) ! 165: *(.eh_frame.*) ! 166: *(.rel) ! 167: *(.rel.*) ! 168: *(.einfo) ! 169: *(.einfo.*) ! 170: *(.discard) ! 171: *(.discard.*) ! 172: } ! 173: ! 174: /* ! 175: * Load address calculations. In older versions of ld, ALIGN() ! 176: * can operate only on the location counter, so we use that. ! 177: * ! 178: */ ! 179: ! 180: . = 0; ! 181: ! 182: . = ALIGN ( _max_align ); ! 183: _prefix_lma = .; ! 184: . += _prefix_filesz; ! 185: ! 186: . = ALIGN ( _max_align ); ! 187: _text16_early_lma = .; ! 188: . += _text16_early_filesz; ! 189: ! 190: . = ALIGN ( _max_align ); ! 191: _payload_lma = .; ! 192: _text16_late_lma = .; ! 193: . += _text16_late_filesz; ! 194: ! 195: . = ALIGN ( _max_align ); ! 196: _data16_lma = .; ! 197: . += _data16_filesz; ! 198: ! 199: . = ALIGN ( _max_align ); ! 200: _textdata_lma = .; ! 201: . += _textdata_filesz; ! 202: ! 203: _filesz = .; /* Do not include zinfo block in file size */ ! 204: ! 205: . = ALIGN ( _max_align ); ! 206: _zinfo_lma = .; ! 207: . += _zinfo_filesz; ! 208: ! 209: . = ALIGN ( _max_align ); ! 210: _end_lma = .; ! 211: ! 212: /* ! 213: * Values calculated to save code from doing it ! 214: * ! 215: */ ! 216: _text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 ); ! 217: _data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 ); ! 218: _textdata_memsz_pgh = ( ( _textdata_memsz + 15 ) / 16 ); ! 219: _textdata_memsz_kb = ( ( _textdata_memsz + 1023 ) / 1024 ); ! 220: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.