|
| 1 | +/*************************************************************************** |
| 2 | + * Copyright (C) 2019 PCSX-Redux authors * |
| 3 | + * * |
| 4 | + * This program is free software; you can redistribute it and/or modify * |
| 5 | + * it under the terms of the GNU General Public License as published by * |
| 6 | + * the Free Software Foundation; either version 2 of the License, or * |
| 7 | + * (at your option) any later version. * |
| 8 | + * * |
| 9 | + * This program is distributed in the hope that it will be useful, * |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 12 | + * GNU General Public License for more details. * |
| 13 | + * * |
| 14 | + * You should have received a copy of the GNU General Public License * |
| 15 | + * along with this program; if not, write to the * |
| 16 | + * Free Software Foundation, Inc., * |
| 17 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * |
| 18 | + ***************************************************************************/ |
| 19 | + |
| 20 | +OUTPUT_FORMAT("elf32-tradlittlemips") |
| 21 | +OUTPUT_ARCH(mips) |
| 22 | + |
| 23 | +EXTERN(_start) |
| 24 | +ENTRY(_start) |
| 25 | + |
| 26 | +MEMORY { |
| 27 | + ram (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000 |
| 28 | + dcache : ORIGIN = 0x1f800000, LENGTH = 0x400 |
| 29 | +} |
| 30 | + |
| 31 | +__ram_top = ORIGIN(ram) + LENGTH(ram); |
| 32 | +__sp = __ram_top - 0x100; |
| 33 | + |
| 34 | +__dcache = ORIGIN(dcache); |
| 35 | +__dcache_top = ORIGIN(dcache) + LENGTH(dcache); |
| 36 | + |
| 37 | +__bss_len = (__bss_end - __bss_start); |
| 38 | + |
| 39 | +SECTIONS { |
| 40 | + __text_start = .; |
| 41 | + .text : { |
| 42 | + *(.start) |
| 43 | + *(.init) |
| 44 | + KEEP (*(SORT_NONE(.fini))) |
| 45 | + *(.text.unlikely .text.*_unlikely .text.unlikely.*) |
| 46 | + *(.text.exit .text.exit.*) |
| 47 | + *(.text.startup .text.startup.*) |
| 48 | + *(.text.hot .text.hot.*) |
| 49 | + *(.text .stub .text.* .gnu.linkonce.t.*) |
| 50 | + . = ALIGN(4); |
| 51 | + } > ram |
| 52 | + |
| 53 | + .fini : { |
| 54 | + } > ram |
| 55 | + . = ALIGN(4); |
| 56 | + __text_end = .; |
| 57 | + |
| 58 | + .rodata : { |
| 59 | + *(.rodata .rodata.* .rdata .rdata.* .gnu.linkonce.r.*) |
| 60 | + } > ram |
| 61 | + |
| 62 | + .rodata1 : { |
| 63 | + *(.rodata1) |
| 64 | + } > ram |
| 65 | + |
| 66 | + __data_start = .; |
| 67 | + .data : { |
| 68 | + *(.a0table) |
| 69 | + *(.data .data.* .gnu.linkonce.d.*) |
| 70 | + *(.data1) |
| 71 | + *(.got.plt) |
| 72 | + *(.got) |
| 73 | + } > ram |
| 74 | + |
| 75 | + . = ALIGN(4); |
| 76 | + |
| 77 | + __bss_start = .; |
| 78 | + .sbss : { |
| 79 | + *(.dynsbss) |
| 80 | + *(.sbss .sbss.* .gnu.linkonce.sb.*) |
| 81 | + *(.scommon) |
| 82 | + *(.dynbss) |
| 83 | + *(.bss .bss.* .gnu.linkonce.b.*) |
| 84 | + *(COMMON) |
| 85 | + } > ram |
| 86 | + |
| 87 | + . = ALIGN(4); |
| 88 | + __bss_end = .; |
| 89 | + |
| 90 | + __end = .; |
| 91 | + |
| 92 | + /DISCARD/ : { *(.MIPS.abiflags) } |
| 93 | + |
| 94 | + /* Everything is statically linked, so discard PLTs. */ |
| 95 | + /DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) } |
| 96 | + |
| 97 | + /* We don't make use of debugging information, so drop that, too. */ |
| 98 | + /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) } |
| 99 | + |
| 100 | + /* Discard things that the standard link script drops, too. */ |
| 101 | + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } |
| 102 | + |
| 103 | + /DISCARD/ : { *(.note.gnu.build-id) } |
| 104 | +} |
0 commit comments