[3f432fbd] | 1 | /* |
---|
| 2 | * Copy of default "default linker script, for normal executables" |
---|
| 3 | * provided with binutils 2.18 with minor modifications for use |
---|
| 4 | * as pc386 linkcmds. These changes include: |
---|
| 5 | * |
---|
| 6 | * + sections commented out marked with "XXX commented out --joel" |
---|
| 7 | * + addition of m_hdr section |
---|
| 8 | * + addition of FreeBSD sysctl sections |
---|
| 9 | */ |
---|
[7150f00f] | 10 | |
---|
[3f432fbd] | 11 | /* |
---|
| 12 | * XXX commented out --joel |
---|
| 13 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", |
---|
| 14 | "elf32-i386") |
---|
| 15 | OUTPUT_ARCH(i386) |
---|
| 16 | ENTRY(_start) |
---|
| 17 | */ |
---|
[9559674] | 18 | HeapSize = DEFINED(HeapSize) ? HeapSize : |
---|
| 19 | DEFINED(_HeapSize) ? _HeapSize : 0x0; |
---|
| 20 | RamSize = DEFINED(RamSize) ? RamSize : |
---|
| 21 | DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF; |
---|
[ef37cb6] | 22 | |
---|
[7150f00f] | 23 | SECTIONS |
---|
| 24 | { |
---|
[3f432fbd] | 25 | /* Read-only sections, merged into text segment: */ |
---|
| 26 | /* |
---|
| 27 | * XXX commented out --joel |
---|
| 28 | PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS; |
---|
[99826740] | 29 | */ |
---|
[3f432fbd] | 30 | .interp : { *(.interp) } |
---|
| 31 | .note.gnu.build-id : { *(.note.gnu.build-id) } |
---|
| 32 | .hash : { *(.hash) } |
---|
| 33 | .gnu.hash : { *(.gnu.hash) } |
---|
| 34 | .dynsym : { *(.dynsym) } |
---|
| 35 | .dynstr : { *(.dynstr) } |
---|
| 36 | .gnu.version : { *(.gnu.version) } |
---|
| 37 | .gnu.version_d : { *(.gnu.version_d) } |
---|
| 38 | .gnu.version_r : { *(.gnu.version_r) } |
---|
| 39 | .rel.init : { *(.rel.init) } |
---|
| 40 | .rela.init : { *(.rela.init) } |
---|
| 41 | .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } |
---|
| 42 | .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } |
---|
| 43 | .rel.fini : { *(.rel.fini) } |
---|
| 44 | .rela.fini : { *(.rela.fini) } |
---|
| 45 | .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } |
---|
| 46 | .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } |
---|
| 47 | .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } |
---|
| 48 | .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } |
---|
| 49 | .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } |
---|
| 50 | .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } |
---|
| 51 | .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } |
---|
| 52 | .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } |
---|
| 53 | .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } |
---|
| 54 | .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } |
---|
| 55 | .rel.ctors : { *(.rel.ctors) } |
---|
| 56 | .rela.ctors : { *(.rela.ctors) } |
---|
| 57 | .rel.dtors : { *(.rel.dtors) } |
---|
| 58 | .rela.dtors : { *(.rela.dtors) } |
---|
| 59 | .rel.got : { *(.rel.got) } |
---|
| 60 | .rela.got : { *(.rela.got) } |
---|
| 61 | .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } |
---|
| 62 | .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } |
---|
| 63 | .rel.plt : { *(.rel.plt) } |
---|
| 64 | .rela.plt : { *(.rela.plt) } |
---|
| 65 | .plt : { *(.plt) } |
---|
| 66 | .text : |
---|
[7150f00f] | 67 | { |
---|
[3f432fbd] | 68 | *(.m_hdr) |
---|
| 69 | *(.text .stub .text.* .gnu.linkonce.t.*) |
---|
| 70 | KEEP (*(.text.*personality*)) |
---|
| 71 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
| 72 | *(.gnu.warning) |
---|
[c2395717] | 73 | |
---|
| 74 | } =0x90909090 |
---|
| 75 | |
---|
| 76 | .robsdsets : { |
---|
| 77 | /* for pre rtems-libbsd FreeBSD code */ |
---|
[7b0c547a] | 78 | __start_set_sysctl_set = .; |
---|
| 79 | *(set_sysctl_*); |
---|
[c2395717] | 80 | __stop_set_sysctl_set = .; |
---|
[7b0c547a] | 81 | *(set_domain_*); |
---|
| 82 | *(set_pseudo_*); |
---|
[c2395717] | 83 | |
---|
| 84 | /* for rtems-libbsd FreeBSD code */ |
---|
[bb08c0c8] | 85 | _bsd__start_set_modmetadata_set = .; |
---|
| 86 | *(_bsd_set_modmetadata_set); |
---|
| 87 | _bsd__stop_set_modmetadata_set = .; |
---|
[c2395717] | 88 | |
---|
[bb08c0c8] | 89 | _bsd__start_set_sysctl_set = .; |
---|
| 90 | *(_bsd_set_sysctl_set); |
---|
| 91 | _bsd__stop_set_sysctl_set = .; |
---|
[c2395717] | 92 | |
---|
[bb08c0c8] | 93 | _bsd__start_set_sysinit_set = .; |
---|
| 94 | *(_bsd_set_sysinit_*); |
---|
| 95 | _bsd__stop_set_sysinit_set = .; |
---|
| 96 | |
---|
| 97 | bsp_section_rodata_end = .; |
---|
[3f432fbd] | 98 | } =0x90909090 |
---|
[a863c50] | 99 | |
---|
[3f432fbd] | 100 | .init : |
---|
| 101 | { |
---|
| 102 | KEEP (*(.init)) |
---|
| 103 | } =0x90909090 |
---|
| 104 | .fini : |
---|
| 105 | { |
---|
| 106 | KEEP (*(.fini)) |
---|
| 107 | } =0x90909090 |
---|
| 108 | PROVIDE (__etext = .); |
---|
| 109 | PROVIDE (_etext = .); |
---|
| 110 | PROVIDE (etext = .); |
---|
| 111 | .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
---|
| 112 | .rodata1 : { *(.rodata1) } |
---|
| 113 | .eh_frame_hdr : { *(.eh_frame_hdr) } |
---|
| 114 | .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } |
---|
| 115 | .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } |
---|
| 116 | /* Adjust the address for the data segment. We want to adjust up to |
---|
| 117 | the same address within the page on the next page up. */ |
---|
| 118 | . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); |
---|
| 119 | /* Exception handling */ |
---|
| 120 | .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } |
---|
| 121 | .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } |
---|
| 122 | /* Thread Local Storage sections */ |
---|
| 123 | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } |
---|
| 124 | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } |
---|
| 125 | .preinit_array : |
---|
| 126 | { |
---|
| 127 | PROVIDE_HIDDEN (__preinit_array_start = .); |
---|
| 128 | KEEP (*(.preinit_array)) |
---|
| 129 | PROVIDE_HIDDEN (__preinit_array_end = .); |
---|
[7150f00f] | 130 | } |
---|
[3f432fbd] | 131 | .init_array : |
---|
[7150f00f] | 132 | { |
---|
[3f432fbd] | 133 | PROVIDE_HIDDEN (__init_array_start = .); |
---|
| 134 | KEEP (*(SORT(.init_array.*))) |
---|
| 135 | KEEP (*(.init_array)) |
---|
| 136 | PROVIDE_HIDDEN (__init_array_end = .); |
---|
[7150f00f] | 137 | } |
---|
[3f432fbd] | 138 | .fini_array : |
---|
[7150f00f] | 139 | { |
---|
[3f432fbd] | 140 | PROVIDE_HIDDEN (__fini_array_start = .); |
---|
| 141 | KEEP (*(.fini_array)) |
---|
| 142 | KEEP (*(SORT(.fini_array.*))) |
---|
| 143 | PROVIDE_HIDDEN (__fini_array_end = .); |
---|
[7150f00f] | 144 | } |
---|
[3f432fbd] | 145 | .ctors : |
---|
| 146 | { |
---|
| 147 | /* gcc uses crtbegin.o to find the start of |
---|
| 148 | the constructors, so we make sure it is |
---|
| 149 | first. Because this is a wildcard, it |
---|
| 150 | doesn't matter if the user does not |
---|
| 151 | actually link against crtbegin.o; the |
---|
| 152 | linker won't look for a file to match a |
---|
| 153 | wildcard. The wildcard also means that it |
---|
| 154 | doesn't matter which directory crtbegin.o |
---|
| 155 | is in. */ |
---|
| 156 | KEEP (*crtbegin.o(.ctors)) |
---|
| 157 | KEEP (*crtbegin?.o(.ctors)) |
---|
| 158 | /* We don't want to include the .ctor section from |
---|
| 159 | the crtend.o file until after the sorted ctors. |
---|
| 160 | The .ctor section from the crtend file contains the |
---|
| 161 | end of ctors marker and it must be last */ |
---|
| 162 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) |
---|
| 163 | KEEP (*(SORT(.ctors.*))) |
---|
| 164 | KEEP (*(.ctors)) |
---|
| 165 | } |
---|
| 166 | .dtors : |
---|
| 167 | { |
---|
| 168 | KEEP (*crtbegin.o(.dtors)) |
---|
| 169 | KEEP (*crtbegin?.o(.dtors)) |
---|
| 170 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) |
---|
| 171 | KEEP (*(SORT(.dtors.*))) |
---|
| 172 | KEEP (*(.dtors)) |
---|
| 173 | } |
---|
| 174 | .jcr : { KEEP (*(.jcr)) } |
---|
| 175 | .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } |
---|
| 176 | .dynamic : { *(.dynamic) } |
---|
| 177 | .got : { *(.got) } |
---|
| 178 | . = DATA_SEGMENT_RELRO_END (12, .); |
---|
| 179 | .got.plt : { *(.got.plt) } |
---|
| 180 | .data : |
---|
| 181 | { |
---|
| 182 | *(.data .data.* .gnu.linkonce.d.*) |
---|
| 183 | KEEP (*(.gnu.linkonce.d.*personality*)) |
---|
| 184 | SORT(CONSTRUCTORS) |
---|
| 185 | } |
---|
| 186 | .data1 : { *(.data1) } |
---|
| 187 | _edata = .; PROVIDE (edata = .); |
---|
| 188 | __bss_start = .; |
---|
| 189 | .bss : |
---|
| 190 | { |
---|
| 191 | *(.dynbss) |
---|
| 192 | *(.bss .bss.* .gnu.linkonce.b.*) |
---|
| 193 | *(COMMON) |
---|
| 194 | /* Align here to ensure that the .bss section occupies space up to |
---|
| 195 | _end. Align after .bss to ensure correct alignment even if the |
---|
| 196 | .bss section disappears because there are no input sections. |
---|
| 197 | FIXME: Why do we need it? When there is no .bss section, we don't |
---|
| 198 | pad the .data section. */ |
---|
| 199 | . = ALIGN(. != 0 ? 32 / 8 : 1); |
---|
| 200 | } |
---|
| 201 | . = ALIGN(32 / 8); |
---|
| 202 | . = ALIGN(32 / 8); |
---|
| 203 | _end = .; PROVIDE (end = .); |
---|
[ef37cb6] | 204 | . = ALIGN(0x10); |
---|
| 205 | WorkAreaBase = .; |
---|
[3f432fbd] | 206 | . = DATA_SEGMENT_END (.); |
---|
[ef37cb6] | 207 | |
---|
[4cb5d29] | 208 | /* Stabs debugging sections. */ |
---|
[3f432fbd] | 209 | .stab 0 : { *(.stab) } |
---|
| 210 | .stabstr 0 : { *(.stabstr) } |
---|
| 211 | .stab.excl 0 : { *(.stab.excl) } |
---|
| 212 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
| 213 | .stab.index 0 : { *(.stab.index) } |
---|
[4cb5d29] | 214 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
[3f432fbd] | 215 | .comment 0 : { *(.comment) } |
---|
[4cb5d29] | 216 | /* DWARF debug sections. |
---|
| 217 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
| 218 | of the section so we begin them at 0. */ |
---|
| 219 | /* DWARF 1 */ |
---|
| 220 | .debug 0 : { *(.debug) } |
---|
| 221 | .line 0 : { *(.line) } |
---|
| 222 | /* GNU DWARF 1 extensions */ |
---|
| 223 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 224 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 225 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 226 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 227 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 228 | /* DWARF 2 */ |
---|
[3f432fbd] | 229 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
[4cb5d29] | 230 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 231 | .debug_line 0 : { *(.debug_line) } |
---|
| 232 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 233 | .debug_str 0 : { *(.debug_str) } |
---|
| 234 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 235 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 236 | /* SGI/MIPS DWARF 2 extensions */ |
---|
| 237 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
| 238 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
| 239 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
| 240 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
[3f432fbd] | 241 | /* DWARF 3 */ |
---|
| 242 | .debug_pubtypes 0 : { *(.debug_pubtypes) } |
---|
| 243 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
[df6818f9] | 244 | /* DWARF extension */ |
---|
| 245 | .debug_macro 0 : { *(.debug_macro) } |
---|
[3f432fbd] | 246 | .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } |
---|
| 247 | /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } |
---|
[4cb5d29] | 248 | } |
---|