• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Linker script for an MS-DOS EXE binary; this hard-codes a simple
3 * MZ header without relocations.
4 *
5 * For documentation on the MS-DOS MZ EXE format, see:
6 * http://www.delorie.com/djgpp/doc/exe/
7 */
8
9
10/* Script for -z combreloc: combine and sort reloc sections */
11OUTPUT_FORMAT("elf32-i386", "elf32-i386",
12	      "elf32-i386")
13OUTPUT_ARCH(i386)
14EXTERN(_start)
15ENTRY(_start)
16
17SECTIONS
18{
19	. = 0;
20	/* EXE header, from header.S */
21	.header : {
22		*(.header)
23	} =0
24
25	. = ALIGN(16);
26	__header_size = .;
27	__payload_lma = .;
28
29	. = 0x100000000 - syslinux_size;
30	.payload : AT (__payload_lma) {
31		 __payload_start = .;
32		 *(.payload)
33		 __payload_end = .;
34	}
35	__payload_len = ABSOLUTE(__payload_end) - ABSOLUTE(__payload_start);
36	__payload_dwords = __payload_len >> 2;
37
38	__dgroup_lma = __payload_lma + syslinux_size;
39	__payload_sseg = (__payload_lma - __dgroup_lma) >> 4;
40	_exe_text_seg  = (__dgroup_lma - __header_size) >> 4;
41
42/*
43 *	__assert1 = ASSERT((__payload_len == syslinux_ldlinux_size),
44 *	"syslinux_size must equal the size of .payload");
45 */
46	. = 0;
47	__null = .;
48	.null : AT(__dgroup_lma) {
49		*(.null)
50	}
51
52	. = ALIGN(16);
53	__text_vma = .;
54	.text : AT (__text_vma + __dgroup_lma) {
55		*(.text .stub .text.* .gnu.linkonce.t.*)
56		*(.gnu.warning)
57	} =0x90909090
58	_etext = .;
59
60	. = ALIGN(16);
61	__rodata_vma = .;
62	.rodata : AT (__rodata_vma + __dgroup_lma) {
63		*(.rodata .rodata.* .gnu.linkonce.r.*)
64	}
65
66	/* Adjust the address for the data segment.  Avoid mixing code and
67	   data within same 128-byte chunk. */
68	. = ALIGN(128);
69	__data_vma = .;
70	.data : AT (__data_vma + __dgroup_lma) {
71		*(.data .data.* .gnu.linkonce.d.*)
72		SORT(CONSTRUCTORS)
73	}
74	.data1 : { *(.data1) }
75	_edata = .;
76
77	_exe_edata_low    = ((_edata + __dgroup_lma) & 511);
78	_exe_edata_blocks = ((_edata + __dgroup_lma) + 511) >> 9;
79
80	.bss (NOLOAD) : {
81		__bss_start = .;
82		*(.dynbss)
83		*(.bss .bss.* .gnu.linkonce.b.*)
84		*(COMMON)
85		__bss_end = .;
86	}
87
88	. = ALIGN(16);
89	.heap (NOLOAD) : {
90		__heap_start = .;
91		*(.heap)
92		__heap_end = .;
93	}
94
95	. = ALIGN(16);
96	.stack (NOLOAD) : {
97		__stack_start = .;
98		*(.stack)
99		__stack_end = .;
100	}
101	. = ALIGN(16);
102	_end = .;
103
104	_exe_bss_paras = (_end - __bss_start) >> 4;
105
106
107  /* Stabs debugging sections.  */
108  .stab          0 : { *(.stab) }
109  .stabstr       0 : { *(.stabstr) }
110  .stab.excl     0 : { *(.stab.excl) }
111  .stab.exclstr  0 : { *(.stab.exclstr) }
112  .stab.index    0 : { *(.stab.index) }
113  .stab.indexstr 0 : { *(.stab.indexstr) }
114  .comment       0 : { *(.comment) }
115  /* DWARF debug sections.
116     Symbols in the DWARF debugging sections are relative to the beginning
117     of the section so we begin them at 0.  */
118  /* DWARF 1 */
119  .debug          0 : { *(.debug) }
120  .line           0 : { *(.line) }
121  /* GNU DWARF 1 extensions */
122  .debug_srcinfo  0 : { *(.debug_srcinfo) }
123  .debug_sfnames  0 : { *(.debug_sfnames) }
124  /* DWARF 1.1 and DWARF 2 */
125  .debug_aranges  0 : { *(.debug_aranges) }
126  .debug_pubnames 0 : { *(.debug_pubnames) }
127  /* DWARF 2 */
128  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
129  .debug_abbrev   0 : { *(.debug_abbrev) }
130  .debug_line     0 : { *(.debug_line) }
131  .debug_frame    0 : { *(.debug_frame) }
132  .debug_str      0 : { *(.debug_str) }
133  .debug_loc      0 : { *(.debug_loc) }
134  .debug_macinfo  0 : { *(.debug_macinfo) }
135  /* SGI/MIPS DWARF 2 extensions */
136  .debug_weaknames 0 : { *(.debug_weaknames) }
137  .debug_funcnames 0 : { *(.debug_funcnames) }
138  .debug_typenames 0 : { *(.debug_typenames) }
139  .debug_varnames  0 : { *(.debug_varnames) }
140  /DISCARD/ : { *(.note.GNU-stack) }
141}
142