|
3 | 3 | # ____| | ____| | | |____| |
4 | 4 | # | ___| |____ ___| ____| | \ PS2DEV Open Source Project. |
5 | 5 | #----------------------------------------------------------------------- |
6 | | -# Copyright 2001-2022, ps2dev - http://www.ps2dev.org |
| 6 | +# Copyright ps2dev - http://www.ps2dev.org |
7 | 7 | # Licenced under Academic Free License version 2.0 |
8 | 8 | # Review ps2sdk README & LICENSE files for further details. |
9 | 9 | # |
10 | 10 | # Linkfile script for iop-ld |
11 | 11 | */ |
12 | 12 |
|
13 | | -OUTPUT_FORMAT("elf32-littlemips") |
14 | | -SEARCH_DIR(""); |
| 13 | +OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", |
| 14 | + "elf32-littlemips") |
| 15 | +OUTPUT_ARCH(mips) |
15 | 16 | ENTRY(_start) |
16 | | -PHDRS |
17 | | -{ |
18 | | - irxhdr 0x70000080 FLAGS (PF_R); /* 0x70000080 -> PT_SCE_IOPMOD */ |
19 | | - defhdr PT_LOAD FLAGS (PF_X | PF_W | PF_R); |
20 | | -} |
| 17 | + SEARCH_DIR(""); |
| 18 | +/* FORCE_COMMON_ALLOCATION */ |
| 19 | +/* Do we need any of these for elf? |
| 20 | + __DYNAMIC = 0; */ |
21 | 21 | SECTIONS |
22 | 22 | { |
23 | | - . = SIZEOF_HEADERS; |
24 | | - |
25 | | - .text 0 : ALIGN(16) { |
26 | | - CREATE_OBJECT_SYMBOLS |
27 | | - PROVIDE (_ftext = .) ; |
28 | | - KEEP (* ( .module.imports )) ; |
29 | | - * ( .text ) |
30 | | - * ( .text.* ) |
31 | | - * ( .init ) |
32 | | - * ( .fini ) |
33 | | - KEEP (* ( .module.exports )) ; |
34 | | - PROVIDE (_etext = .) ; |
35 | | - } :defhdr = 0 |
36 | | - |
37 | | - .rodata : ALIGN(16) { |
38 | | - * ( .rdata ) |
39 | | - * ( .rodata ) |
40 | | - * ( .rodata1 ) |
41 | | - * ( .rodata.* ) |
42 | | - } :defhdr = 0 |
43 | | - |
44 | | - .data : ALIGN(16) { |
45 | | - * ( .data ) |
46 | | - * ( .data1 ) |
47 | | - * ( .data.* ) |
48 | | - CONSTRUCTORS |
49 | | - } :defhdr = 0 |
50 | | - |
51 | | - .bss : ALIGN(16) { |
52 | | - * ( .bss ) |
53 | | - * ( .bss.* ) |
54 | | - * ( COMMON ) |
55 | | - . = ALIGN(4) ; |
56 | | - } :defhdr |
57 | | - _gp = ALIGN(16) ; |
58 | | - |
59 | | - /* |
60 | | - * This is the .iopmod section for the IRX, it contains information that |
61 | | - * the IOP uses when loading the IRX. |
62 | | - * This section is placed in its own segment. |
63 | | - */ |
64 | | - .iopmod 0 (COPY) : ALIGN(4) { |
65 | | - /* |
66 | | - * The linker will replace this first LONG with a pointer to _irx_id |
67 | | - * if the symbol has been defined. |
68 | | - */ |
69 | | - LONG (DEFINED(_irx_id) ? ABSOLUTE(_irx_id) : 0xffffffff) ; |
70 | | - LONG (ABSOLUTE(_start)) ; |
71 | | - LONG (_gp) ; |
72 | | - LONG (SIZEOF(.text)) ; |
73 | | - LONG (SIZEOF(.data)) ; |
74 | | - LONG (SIZEOF(.bss)) ; |
75 | | - /* |
76 | | - * The linker will put a SHORT here with the version of the IRX |
77 | | - * (or zero if there is no version). |
78 | | - */ |
79 | | - /* |
80 | | - * The linker will put a null terminated string here containing the |
81 | | - * name of the IRX (or an empty string if the name is not known). |
82 | | - */ |
83 | | - KEEP (* ( .iopmod.version )) ; |
84 | | - KEEP (* ( .iopmod.name )) ; |
85 | | - FILL(0x00000000); |
86 | | - } :irxhdr = 0 |
87 | | - |
88 | | - /* |
89 | | - * These are the stuff that we don't want to be put in an IRX. |
90 | | - */ |
91 | | - /DISCARD/ : { |
92 | | - * ( .MIPS.abiflags ) |
93 | | - * ( .comment ) |
94 | | - * ( .debug_* ) |
95 | | - * ( .gnu.attributes ) |
96 | | - * ( .mdebug.* ) |
97 | | - * ( .reginfo ) |
98 | | - * ( .symtab ) |
99 | | - * ( .strtab ) |
100 | | - * ( .shstrtab ) |
101 | | - * ( .eh_frame ) |
102 | | - /* |
103 | | - * This must go because it confuses the IOP kernel (treated as a reloc section). |
104 | | - */ |
105 | | - * ( .pdr ) |
106 | | - /* |
107 | | - * Until I can figure out if there's a better way to rid ourselves of |
108 | | - * .rel.dyn this will have to do. - MRB |
109 | | - */ |
110 | | - * ( .rel.dyn ) |
111 | | - } |
| 23 | + /* Read-only sections, merged into text segment: */ |
| 24 | + . = 0x0400000; /* Can conditionally be changed to . = 0x5ffe0000 + SIZEOF_HEADERS; */ |
| 25 | + .interp : { *(.interp) } /* Can conditionally be removed */ |
| 26 | + .reginfo : { *(.reginfo) } |
| 27 | + .hash : { *(.hash) } |
| 28 | + .dynsym : { *(.dynsym) } |
| 29 | + .dynstr : { *(.dynstr) } |
| 30 | + .gnu.version : { *(.gnu.version) } |
| 31 | + .gnu.version_d : { *(.gnu.version_d) } |
| 32 | + .gnu.version_r : { *(.gnu.version_r) } |
| 33 | + .rel.text : |
| 34 | + { *(.rel.text) *(.rel.gnu.linkonce.t*) } |
| 35 | + .rela.text : |
| 36 | + { *(.rela.text) *(.rela.gnu.linkonce.t*) } |
| 37 | + .rel.data : |
| 38 | + { *(.rel.data) *(.rel.gnu.linkonce.d*) } |
| 39 | + .rela.data : |
| 40 | + { *(.rela.data) *(.rela.gnu.linkonce.d*) } |
| 41 | + .rel.rodata : |
| 42 | + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } |
| 43 | + .rela.rodata : |
| 44 | + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } |
| 45 | + .rel.got : { *(.rel.got) } |
| 46 | + .rela.got : { *(.rela.got) } |
| 47 | + .rel.ctors : { *(.rel.ctors) } |
| 48 | + .rela.ctors : { *(.rela.ctors) } |
| 49 | + .rel.dtors : { *(.rel.dtors) } |
| 50 | + .rela.dtors : { *(.rela.dtors) } |
| 51 | + .rel.init : { *(.rel.init) } |
| 52 | + .rela.init : { *(.rela.init) } |
| 53 | + .rel.fini : { *(.rel.fini) } |
| 54 | + .rela.fini : { *(.rela.fini) } |
| 55 | + .rel.bss : { *(.rel.bss) } |
| 56 | + .rela.bss : { *(.rela.bss) } |
| 57 | + .rel.plt : { *(.rel.plt) } |
| 58 | + .rela.plt : { *(.rela.plt) } |
| 59 | + .init : { *(.init) } =0 |
| 60 | + .plt : { *(.plt) } |
| 61 | + .text : |
| 62 | + { |
| 63 | + PROVIDE(_ftext = . ); |
| 64 | + *(.text) |
| 65 | + *(.stub) |
| 66 | + /* .gnu.warning sections are handled specially by elf32.em. */ |
| 67 | + *(.gnu.warning) |
| 68 | + *(.gnu.linkonce.t*) |
| 69 | + *(.mips16.fn.*) *(.mips16.call.*) |
| 70 | + } =0 |
| 71 | + PROVIDE(_etext = .); |
| 72 | + PROVIDE (etext = .); |
| 73 | + .fini : { *(.fini) } =0 |
| 74 | + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } |
| 75 | + .rodata1 : { *(.rodata1) } |
| 76 | + /* Adjust the address for the data segment. We want to adjust up to |
| 77 | + the same address within the page on the next page up. */ |
| 78 | + . = ALIGN(0x40000) + (. & (0x40000 - 1)); /* Can conditionally be changed to . = .; */ |
| 79 | + .data : |
| 80 | + { |
| 81 | + PROVIDE(_fdata = .); |
| 82 | + *(.data) |
| 83 | + *(.gnu.linkonce.d*) |
| 84 | + CONSTRUCTORS |
| 85 | + } |
| 86 | + .data1 : { *(.data1) } |
| 87 | + .ctors : |
| 88 | + { |
| 89 | + *(.ctors) |
| 90 | + } |
| 91 | + .dtors : |
| 92 | + { |
| 93 | + *(.dtors) |
| 94 | + } |
| 95 | + PROVIDE(_gp = ALIGN(16) + 0x7ff0); |
| 96 | + .got : { *(.got.plt) *(.got) } |
| 97 | + .dynamic : { *(.dynamic) } |
| 98 | + /* We want the small data sections together, so single-instruction offsets |
| 99 | + can access them all, and initialized data all before uninitialized, so |
| 100 | + we can shorten the on-disk segment size. */ |
| 101 | + .sdata : { *(.sdata) } |
| 102 | + .lit8 : { *(.lit8) } |
| 103 | + .lit4 : { *(.lit4) } |
| 104 | + PROVIDE(_edata = .); |
| 105 | + PROVIDE (edata = .); |
| 106 | + __bss_start = .; |
| 107 | + PROVIDE(_fbss = .); |
| 108 | + .sbss : { *(.sbss) *(.scommon) } |
| 109 | + .bss : |
| 110 | + { |
| 111 | + *(.dynbss) |
| 112 | + *(.bss) |
| 113 | + *(COMMON) |
| 114 | + } |
| 115 | + . = ALIGN(32 / 8); |
| 116 | + PROVIDE(_end = .); |
| 117 | + PROVIDE (end = .); |
| 118 | + /* Stabs debugging sections. */ |
| 119 | + .stab 0 : { *(.stab) } |
| 120 | + .stabstr 0 : { *(.stabstr) } |
| 121 | + .stab.excl 0 : { *(.stab.excl) } |
| 122 | + .stab.exclstr 0 : { *(.stab.exclstr) } |
| 123 | + .stab.index 0 : { *(.stab.index) } |
| 124 | + .stab.indexstr 0 : { *(.stab.indexstr) } |
| 125 | + .comment 0 : { *(.comment) } |
| 126 | + /* DWARF debug sections. |
| 127 | + Symbols in the DWARF debugging sections are relative to the beginning |
| 128 | + of the section so we begin them at 0. */ |
| 129 | + /* DWARF 1 */ |
| 130 | + .debug 0 : { *(.debug) } |
| 131 | + .line 0 : { *(.line) } |
| 132 | + /* GNU DWARF 1 extensions */ |
| 133 | + .debug_srcinfo 0 : { *(.debug_srcinfo) } |
| 134 | + .debug_sfnames 0 : { *(.debug_sfnames) } |
| 135 | + /* DWARF 1.1 and DWARF 2 */ |
| 136 | + .debug_aranges 0 : { *(.debug_aranges) } |
| 137 | + .debug_pubnames 0 : { *(.debug_pubnames) } |
| 138 | + /* DWARF 2 */ |
| 139 | + .debug_info 0 : { *(.debug_info) } |
| 140 | + .debug_abbrev 0 : { *(.debug_abbrev) } |
| 141 | + .debug_line 0 : { *(.debug_line) } |
| 142 | + .debug_frame 0 : { *(.debug_frame) } |
| 143 | + .debug_str 0 : { *(.debug_str) } |
| 144 | + .debug_loc 0 : { *(.debug_loc) } |
| 145 | + .debug_macinfo 0 : { *(.debug_macinfo) } |
| 146 | + /* SGI/MIPS DWARF 2 extensions */ |
| 147 | + .debug_weaknames 0 : { *(.debug_weaknames) } |
| 148 | + .debug_funcnames 0 : { *(.debug_funcnames) } |
| 149 | + .debug_typenames 0 : { *(.debug_typenames) } |
| 150 | + .debug_varnames 0 : { *(.debug_varnames) } |
| 151 | + /* These must appear regardless of . */ |
| 152 | + .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } |
| 153 | + .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } |
| 154 | + /* |
| 155 | + * These are the stuff that we don't want to be put in an IRX. |
| 156 | + */ |
| 157 | + /DISCARD/ : { |
| 158 | + * ( .MIPS.abiflags ) |
| 159 | + } |
112 | 160 | } |
0 commit comments