1/* SPDX-License-Identifier: GPL-2.0+ */
2
3MEMORY { .spl_mem : ORIGIN = IMAGE_TEXT_BASE, \
4		LENGTH = IMAGE_MAX_SIZE }
5MEMORY { .bss_mem : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
6		LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
7
8OUTPUT_ARCH(mips)
9ENTRY(_start)
10SECTIONS
11{
12	. = 0x00000000;
13
14	. = ALIGN(4);
15	.text : {
16		__text_start = .;
17		*(.text*)
18		__text_end = .;
19	} > .spl_mem
20
21	. = ALIGN(4);
22	.rodata : {
23		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
24	} > .spl_mem
25
26	. = ALIGN(4);
27	.data : {
28		*(SORT_BY_ALIGNMENT(.data*))
29		*(SORT_BY_ALIGNMENT(.sdata*))
30	} > .spl_mem
31
32#if defined(CONFIG_SPL_DM) || defined(CONFIG_SPL_LOADER_SUPPORT)
33	. = ALIGN(4);
34	__u_boot_list : {
35		KEEP(*(SORT(__u_boot_list*)));
36	} > .spl_mem
37#endif
38
39	. = ALIGN(4);
40	__image_copy_end = .;
41	__image_copy_len = __image_copy_end - __text_start;
42
43	_image_binary_end = .;
44
45	.bss (NOLOAD) : {
46		__bss_start = .;
47		*(.bss*)
48		*(.sbss*)
49		*(COMMON)
50		. = ALIGN(4);
51		__bss_end = .;
52	} > .bss_mem
53
54	/* These mark the ABI of U-Boot for debuggers. */
55	.mdebug.abi32 : {
56		KEEP(*(.mdebug.abi32))
57	}
58	.mdebug.abi64 : {
59		KEEP(*(.mdebug.abi64))
60	}
61
62	/* This is the MIPS specific mdebug section. */
63	.mdebug : { *(.mdebug) }
64
65	/* Stabs debugging sections.  */
66	.stab 0 : { *(.stab) }
67	.stabstr 0 : { *(.stabstr) }
68	.stab.excl 0 : { *(.stab.excl) }
69	.stab.exclstr 0 : { *(.stab.exclstr) }
70	.stab.index 0 : { *(.stab.index) }
71	.stab.indexstr 0 : { *(.stab.indexstr) }
72	.comment 0 : { *(.comment) }
73
74	/*
75	 * DWARF debug sections.
76	 * Symbols in the DWARF debugging sections are relative to
77	 * the beginning of the section so we begin them at 0.
78	 */
79	/* DWARF 1 */
80	.debug 0 : { *(.debug) }
81	.line 0 : { *(.line) }
82	/* GNU DWARF 1 extensions */
83	.debug_srcinfo 0 : { *(.debug_srcinfo) }
84	.debug_sfnames 0 : { *(.debug_sfnames) }
85	/* DWARF 1.1 and DWARF 2 */
86	.debug_aranges 0 : { *(.debug_aranges) }
87	.debug_pubnames 0 : { *(.debug_pubnames) }
88	/* DWARF 2 */
89	.debug_info 0 : {
90		*(.debug_info
91		.gnu.linkonce.wi.*)
92	}
93	.debug_abbrev 0 : { *(.debug_abbrev) }
94	.debug_line 0 : { *(.debug_line) }
95	.debug_frame 0 : { *(.debug_frame) }
96	.debug_str 0 : { *(.debug_str) }
97	.debug_loc 0 : { *(.debug_loc) }
98	.debug_macinfo 0 : { *(.debug_macinfo) }
99	.debug_pubtypes 0 : { *(.debug_pubtypes) }
100	/* DWARF 3 */
101	.debug_ranges 0 : { *(.debug_ranges) }
102	/* SGI/MIPS DWARF 2 extensions */
103	.debug_weaknames 0 : { *(.debug_weaknames) }
104	.debug_funcnames 0 : { *(.debug_funcnames) }
105	.debug_typenames 0 : { *(.debug_typenames) }
106	.debug_varnames 0 : { *(.debug_varnames) }
107	/* GNU DWARF 2 extensions */
108	.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
109	.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
110	/* DWARF 4 */
111	.debug_types 0 : { *(.debug_types) }
112	/* DWARF 5 */
113	.debug_macro 0 : { *(.debug_macro) }
114	.debug_addr 0 : { *(.debug_addr) }
115
116	/DISCARD/ : {
117		/* ABI crap starts here */
118		*(.MIPS.abiflags)
119		*(.MIPS.options)
120		*(.options)
121		*(.pdr)
122		*(.reginfo)
123		*(.eh_frame)
124	}
125}
126