2 * libn64/rom.ld: Linker script for ROMs.
4 * n64chain: A (free) open-source N64 development toolchain.
5 * Copyright 2014-16 Tyler J. Stachecki <stachecki.tyler@gmail.com>
7 * This file is subject to the terms and conditions defined in
8 * 'LICENSE', which is part of this source code package.
11 OUTPUT_FORMAT("elf32-bigmips")
18 .text 0xFFFFFFFF80000400 : AT (0xFFFFFFFF80000400) {
26 *(.text.startup .text.startup.*)
27 *(.text.unlikely .text.*_unlikely .text.unlikely.*)
28 *(.text.exit .text.exit.*)
29 *(.text.hot .text.hot.*)
30 *(.text .stub .text.* .gnu.linkonce.t.*)
31 *(.mips16.fn.*) *(.mips16.call.*)
35 KEEP (*(SORT_NONE(.fini)))
39 PROVIDE (__etext = .);
45 *(.rodata.libn64 .rodata .rodata.* .gnu.linkonce.r.*)
53 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
58 *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
67 *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
72 *(.data .data.* .gnu.linkonce.d.*)
83 HIDDEN (_gp = ALIGN(16) + 0x7FF0);
90 *(.sdata .sdata.* .gnu.linkonce.s.*)
102 _edata = .; PROVIDE (edata = .);
111 *(.sbss .sbss.* .gnu.linkonce.sb.*)
117 *(.bss .bss.* .gnu.linkonce.b.*)
124 /* Place the exception handlers that get DMA'd over the MIPS */
125 /* exceptions vector immediately after the end of the BSS. */
126 .exception 0xFFFFFFFF80000000 : AT (__bss_end) {
127 *(.exception.tlbmiss)
128 *(.exception.general)
129 *(.exception.routines)
132 /* And, following that, any resources which live on the cart. */
133 __exception_end = __bss_end + 0x400;
135 .cart 0x30000C00 + __exception_end : AT(__exception_end) {
139 /* Everything is statically linked, so discard PLTs. */
140 /DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) }
142 /* We don't make use of debugging information, so drop that, too. */
143 /DISCARD/ : { *(.debug) *(.debug_srcinfo) *(.debug_sfnames) *(.debug_aranges) *(.debug_pubnames) *(.debug_info .gnu.linkonce.wi.*) *(.debug_abbrev) *(.debug_line .debug_line.* .debug_line_end ) *(.debug_frame) *(.debug_str) *(.debug_loc) *(.debug_macinfo) *(.debug_weaknames) *(.debug_funcnames) *(.debug_typenames) *(.debug_varnames) *(.debug_pubtypes) *(.debug_ranges) *(.debug_macro) *(.mdebug.abi32) *(.mdebug.abiN32) *(.mdebug.abi64) *(.mdebug.abiO64) *(.mdebug.eabi32) *(.mdebug.eabi64) }
145 /* Discard things that the standard link script drops, too. */
146 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
148 /* Don't include MIPS ABI information with the ROM. */
149 /DISCARD/ : { *(.MIPS.abiflags) }