blob: 87731785ec59b2a2542266ea22089d6f6884a36c [file] [log] [blame]
Stefan Roese46499132009-10-27 16:11:26 +01001/*
2 * Copyright 2007-2009 Freescale Semiconductor, Inc.
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese46499132009-10-27 16:11:26 +01005 */
6
7#include "config.h" /* CONFIG_BOARDDIR */
8
9#ifndef RESET_VECTOR_ADDRESS
Ricardo Ribalda Delgadod20b9992010-12-07 14:27:56 +010010#ifdef CONFIG_RESET_VECTOR_ADDRESS
11#define RESET_VECTOR_ADDRESS CONFIG_RESET_VECTOR_ADDRESS
12#else
Stefan Roese46499132009-10-27 16:11:26 +010013#define RESET_VECTOR_ADDRESS 0xfffffffc
14#endif
Ricardo Ribalda Delgadod20b9992010-12-07 14:27:56 +010015#endif
Stefan Roese46499132009-10-27 16:11:26 +010016
17OUTPUT_ARCH(powerpc)
Wolfgang Denkee8028b2010-11-21 20:55:42 +010018
Stefan Roese46499132009-10-27 16:11:26 +010019PHDRS
20{
21 text PT_LOAD;
22 bss PT_LOAD;
23}
24
25SECTIONS
26{
27 /* Read-only sections, merged into text segment: */
28 . = + SIZEOF_HEADERS;
Stefan Roese46499132009-10-27 16:11:26 +010029 .text :
30 {
Wolfgang Denkee8028b2010-11-21 20:55:42 +010031 *(.text*)
Stefan Roese46499132009-10-27 16:11:26 +010032 } :text
33 _etext = .;
34 PROVIDE (etext = .);
35 .rodata :
36 {
Stefan Roese46499132009-10-27 16:11:26 +010037 *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
38 } :text
Stefan Roese46499132009-10-27 16:11:26 +010039
40 /* Read-write section, merged into data segment: */
41 . = (. + 0x00FF) & 0xFFFFFF00;
42 _erotext = .;
43 PROVIDE (erotext = .);
44 .reloc :
45 {
Stefan Roese46499132009-10-27 16:11:26 +010046 _GOT2_TABLE_ = .;
Wolfgang Denkee8028b2010-11-21 20:55:42 +010047 KEEP(*(.got2))
Joakim Tjernlund337f5f52010-12-03 17:30:37 +010048 KEEP(*(.got))
49 PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
Stefan Roese46499132009-10-27 16:11:26 +010050 _FIXUP_TABLE_ = .;
Wolfgang Denkee8028b2010-11-21 20:55:42 +010051 KEEP(*(.fixup))
Stefan Roese46499132009-10-27 16:11:26 +010052 }
Joakim Tjernlund337f5f52010-12-03 17:30:37 +010053 __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
Stefan Roese46499132009-10-27 16:11:26 +010054 __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
55
56 .data :
57 {
Wolfgang Denkee8028b2010-11-21 20:55:42 +010058 *(.data*)
59 *(.sdata*)
Stefan Roese46499132009-10-27 16:11:26 +010060 }
61 _edata = .;
62 PROVIDE (edata = .);
63
64 . = .;
Stefan Roese46499132009-10-27 16:11:26 +010065
Marek Vasut55675142012-10-12 10:27:03 +000066 . = ALIGN(4);
67 .u_boot_list : {
Albert ARIBAUDef123c52013-02-25 00:59:00 +000068 KEEP(*(SORT(.u_boot_list*)));
Marek Vasut55675142012-10-12 10:27:03 +000069 }
70
Stefan Roese46499132009-10-27 16:11:26 +010071 . = .;
72 __start___ex_table = .;
73 __ex_table : { *(__ex_table) }
74 __stop___ex_table = .;
75
76 . = ALIGN(256);
77 __init_begin = .;
78 .text.init : { *(.text.init) }
79 .data.init : { *(.data.init) }
80 . = ALIGN(256);
81 __init_end = .;
82
Stefan Roese98f99e92013-04-02 10:37:04 +020083#ifndef CONFIG_SPL
Stefan Roese46499132009-10-27 16:11:26 +010084#ifdef CONFIG_440
85 .bootpg RESET_VECTOR_ADDRESS - 0xffc :
86 {
Stefan Roesea47a12b2010-04-15 16:07:28 +020087 arch/powerpc/cpu/ppc4xx/start.o (.bootpg)
Stefan Roese46499132009-10-27 16:11:26 +010088
89 /*
90 * PPC440 board need a board specific object with the
91 * TLB definitions. This needs to get included right after
92 * start.o, since the first shadow TLB only covers 4k
93 * of address space.
94 */
Ricardo Ribalda Delgadod20b9992010-12-07 14:27:56 +010095#ifdef CONFIG_INIT_TLB
96 CONFIG_INIT_TLB (.bootpg)
97#else
Stefan Roese46499132009-10-27 16:11:26 +010098 CONFIG_BOARDDIR/init.o (.bootpg)
Ricardo Ribalda Delgadod20b9992010-12-07 14:27:56 +010099#endif
Stefan Roese46499132009-10-27 16:11:26 +0100100 } :text = 0xffff
101#endif
102
103 .resetvec RESET_VECTOR_ADDRESS :
104 {
Wolfgang Denkee8028b2010-11-21 20:55:42 +0100105 KEEP(*(.resetvec))
Stefan Roese46499132009-10-27 16:11:26 +0100106 } :text = 0xffff
107
108 . = RESET_VECTOR_ADDRESS + 0x4;
109
110 /*
111 * Make sure that the bss segment isn't linked at 0x0, otherwise its
112 * address won't be updated during relocation fixups. Note that
113 * this is a temporary fix. Code to dynamically the fixup the bss
114 * location will be added in the future. When the bss relocation
115 * fixup code is present this workaround should be removed.
116 */
117#if (RESET_VECTOR_ADDRESS == 0xfffffffc)
118 . |= 0x10;
119#endif
Stefan Roese98f99e92013-04-02 10:37:04 +0200120#endif /* CONFIG_SPL */
Stefan Roese46499132009-10-27 16:11:26 +0100121
122 __bss_start = .;
123 .bss (NOLOAD) :
124 {
Wolfgang Denkee8028b2010-11-21 20:55:42 +0100125 *(.bss*)
126 *(.sbss*)
Stefan Roese46499132009-10-27 16:11:26 +0100127 *(COMMON)
128 } :bss
129
130 . = ALIGN(4);
Simon Glass3929fb02013-03-14 06:54:53 +0000131 __bss_end = . ;
Stefan Roese46499132009-10-27 16:11:26 +0100132 PROVIDE (end = .);
133}