1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) Copyright 2006
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de
5 *
6 * Copyright 2009 Freescale Semiconductor, Inc.
7 */
8
9#include "config.h"
10
11OUTPUT_ARCH(powerpc)
12#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
13PHDRS
14{
15	text PT_LOAD;
16	bss PT_LOAD;
17}
18#endif
19SECTIONS
20{
21#ifdef CONFIG_TPL_BUILD
22	. = CONFIG_TPL_TEXT_BASE;
23#else
24	. = CONFIG_SPL_TEXT_BASE;
25#endif
26	.text : {
27		*(.text*)
28	}
29	_etext = .;
30
31	.reloc : {
32		_GOT2_TABLE_ = .;
33		KEEP(*(.got2))
34		KEEP(*(.got))
35		_FIXUP_TABLE_ = .;
36		KEEP(*(.fixup))
37	}
38	__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
39	__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
40
41	. = ALIGN(8);
42	.data : {
43		*(.rodata*)
44		*(.data*)
45		*(.sdata*)
46	}
47	_edata  =  .;
48
49	. = ALIGN(4);
50	.u_boot_list : {
51		KEEP(*(SORT(.u_boot_list*)));
52	}
53
54	. = .;
55	__start___ex_table = .;
56	__ex_table : { *(__ex_table) }
57	__stop___ex_table = .;
58
59	. = ALIGN(8);
60	__init_begin = .;
61	__init_end = .;
62	_end = .;
63#ifdef CONFIG_SPL_SKIP_RELOCATE
64	. = ALIGN(4);
65	__bss_start = .;
66	.bss : {
67		*(.sbss*)
68		*(.bss*)
69	}
70	. = ALIGN(4);
71	__bss_end = .;
72#endif
73
74/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
75#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
76	.bootpg ADDR(.text) - 0x1000 :
77	{
78		KEEP(*(.bootpg))
79	} :text = 0xffff
80#else
81#if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
82#ifndef BOOT_PAGE_OFFSET
83#define BOOT_PAGE_OFFSET 0x1000
84#endif
85	.bootpg ADDR(.text) + BOOT_PAGE_OFFSET :
86	{
87		arch/powerpc/cpu/mpc85xx/start.o (.bootpg)
88	}
89#ifndef RESET_VECTOR_OFFSET
90#define RESET_VECTOR_OFFSET 0x1ffc /* IFC has 8K sram */
91#endif
92#elif defined(CONFIG_FSL_ELBC)
93#define RESET_VECTOR_OFFSET 0xffc /* LBC has 4k sram */
94#else
95#error unknown NAND controller
96#endif
97	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
98		KEEP(*(.resetvec))
99	} = 0xffff
100#endif
101
102#ifndef CONFIG_SPL_SKIP_RELOCATE
103	/*
104	 * Make sure that the bss segment isn't linked at 0x0, otherwise its
105	 * address won't be updated during relocation fixups.
106	 */
107	. |= 0x10;
108
109	. = ALIGN(4);
110	__bss_start = .;
111	.bss : {
112		*(.sbss*)
113		*(.bss*)
114	}
115	. = ALIGN(4);
116	__bss_end = .;
117#endif
118}
119