Update toolchain to use GCC 8.1.
[n64chain.git] / libn64 / rom.ld
1 /*
2 * libn64/rom.ld: Linker script for ROMs.
3 *
4 * n64chain: A (free) open-source N64 development toolchain.
5 * Copyright 2014-16 Tyler J. Stachecki <stachecki.tyler@gmail.com>
6 *
7 * This file is subject to the terms and conditions defined in
8 * 'LICENSE', which is part of this source code package.
9 */
10
11 OUTPUT_FORMAT("elf32-bigmips")
12 OUTPUT_ARCH(mips)
13
14 EXTERN(libn64_ipl)
15 ENTRY(libn64_ipl)
16
17 SECTIONS {
18 .text 0xFFFFFFFF80000400 : AT (0xFFFFFFFF80000400) {
19 *(.text.libn64.ipl)
20 *(.text.libn64.asm)
21 *(.text.libn64);
22
23 . = ALIGN(32);
24 _ftext = .;
25
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.*)
32 }
33
34 .fini : {
35 KEEP (*(SORT_NONE(.fini)))
36 }
37
38 . = ALIGN(32);
39 PROVIDE (__etext = .);
40 PROVIDE (_etext = .);
41 PROVIDE (etext = .);
42
43 /* DATA */
44 .rodata : {
45 *(.rodata.libn64 .rodata .rodata.* .gnu.linkonce.r.*)
46 }
47
48 .rodata1 : {
49 *(.rodata1)
50 }
51
52 .sdata2 : {
53 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
54 }
55
56 __sbss2_start = .;
57 .sbss2 : {
58 *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
59 }
60 __sbss2_end = .;
61
62 .jcr : {
63 KEEP (*(.jcr))
64 }
65
66 .data.rel.ro : {
67 *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
68 }
69
70 .data : {
71 _fdata = . ;
72 *(.data .data.* .gnu.linkonce.d.*)
73 }
74
75 .data1 : {
76 *(.data1)
77 }
78
79 .got.plt : {
80 *(.got.plt)
81 }
82
83 HIDDEN (_gp = ALIGN(16) + 0x7FF0);
84
85 .got : {
86 *(.got)
87 }
88
89 .sdata : {
90 *(.sdata .sdata.* .gnu.linkonce.s.*)
91 }
92
93 .lit8 : {
94 *(.lit8)
95 }
96
97 .lit4 : {
98 *(.lit4)
99 }
100
101 . = ALIGN(16);
102 _edata = .; PROVIDE (edata = .);
103
104 /* BSS */
105 . = ALIGN(16);
106 __bss_start = .;
107 _fbss = .;
108
109 .sbss : {
110 *(.dynsbss)
111 *(.sbss .sbss.* .gnu.linkonce.sb.*)
112 *(.scommon)
113 }
114
115 .bss : {
116 *(.dynbss)
117 *(.bss .bss.* .gnu.linkonce.b.*)
118 *(COMMON)
119 }
120
121 . = ALIGN(16);
122 __bss_end = .;
123
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)
130 }
131
132 /* And, following that, any resources which live on the cart. */
133 __exception_end = __bss_end + 0x400;
134
135 .cart 0x30000C00 + __exception_end : AT(__exception_end) {
136 *(.cart.libn64.*)
137 }
138
139 /* Everything is statically linked, so discard PLTs. */
140 /DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) }
141
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) }
144
145 /* Discard things that the standard link script drops, too. */
146 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
147
148 /* Don't include MIPS ABI information with the ROM. */
149 /DISCARD/ : { *(.MIPS.abiflags) }
150 }
151