Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2007-2009 Freescale Semiconductor, Inc. |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include "config.h" /* CONFIG_BOARDDIR */ |
| 8 | |
| 9 | #ifndef RESET_VECTOR_ADDRESS |
Ricardo Ribalda Delgado | b384381 | 2010-12-07 14:27:56 +0100 | [diff] [blame] | 10 | #ifdef CONFIG_RESET_VECTOR_ADDRESS |
| 11 | #define RESET_VECTOR_ADDRESS CONFIG_RESET_VECTOR_ADDRESS |
| 12 | #else |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 13 | #define RESET_VECTOR_ADDRESS 0xfffffffc |
| 14 | #endif |
Ricardo Ribalda Delgado | b384381 | 2010-12-07 14:27:56 +0100 | [diff] [blame] | 15 | #endif |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 16 | |
| 17 | OUTPUT_ARCH(powerpc) |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 18 | |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 19 | PHDRS |
| 20 | { |
| 21 | text PT_LOAD; |
| 22 | bss PT_LOAD; |
| 23 | } |
| 24 | |
| 25 | SECTIONS |
| 26 | { |
| 27 | /* Read-only sections, merged into text segment: */ |
| 28 | . = + SIZEOF_HEADERS; |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 29 | .text : |
| 30 | { |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 31 | *(.text*) |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 32 | } :text |
| 33 | _etext = .; |
| 34 | PROVIDE (etext = .); |
| 35 | .rodata : |
| 36 | { |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 37 | *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) |
| 38 | } :text |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 39 | |
| 40 | /* Read-write section, merged into data segment: */ |
| 41 | . = (. + 0x00FF) & 0xFFFFFF00; |
| 42 | _erotext = .; |
| 43 | PROVIDE (erotext = .); |
| 44 | .reloc : |
| 45 | { |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 46 | _GOT2_TABLE_ = .; |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 47 | KEEP(*(.got2)) |
Joakim Tjernlund | 42126a6 | 2010-12-03 17:30:37 +0100 | [diff] [blame] | 48 | KEEP(*(.got)) |
| 49 | PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 50 | _FIXUP_TABLE_ = .; |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 51 | KEEP(*(.fixup)) |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 52 | } |
Joakim Tjernlund | 42126a6 | 2010-12-03 17:30:37 +0100 | [diff] [blame] | 53 | __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1; |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 54 | __fixup_entries = (. - _FIXUP_TABLE_) >> 2; |
| 55 | |
| 56 | .data : |
| 57 | { |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 58 | *(.data*) |
| 59 | *(.sdata*) |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 60 | } |
| 61 | _edata = .; |
| 62 | PROVIDE (edata = .); |
| 63 | |
| 64 | . = .; |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 65 | |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 66 | . = ALIGN(4); |
| 67 | .u_boot_list : { |
Albert ARIBAUD | c24895e | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 68 | KEEP(*(SORT(.u_boot_list*))); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 69 | } |
| 70 | |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 71 | . = .; |
| 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) } |
Simon Glass | 2713fcf | 2015-02-07 11:51:44 -0700 | [diff] [blame] | 79 | .data.init : { |
| 80 | *(.data.init) |
| 81 | . = ALIGN(256); |
| 82 | LONG(0) LONG(0) /* Extend u-boot.bin to here */ |
| 83 | } |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 84 | __init_end = .; |
Simon Glass | 2713fcf | 2015-02-07 11:51:44 -0700 | [diff] [blame] | 85 | _end = .; |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 86 | |
Stefan Roese | 07038ad | 2013-04-02 10:37:04 +0200 | [diff] [blame] | 87 | #ifndef CONFIG_SPL |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 88 | #ifdef CONFIG_440 |
| 89 | .bootpg RESET_VECTOR_ADDRESS - 0xffc : |
| 90 | { |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 91 | arch/powerpc/cpu/ppc4xx/start.o (.bootpg) |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 92 | |
| 93 | /* |
| 94 | * PPC440 board need a board specific object with the |
| 95 | * TLB definitions. This needs to get included right after |
| 96 | * start.o, since the first shadow TLB only covers 4k |
| 97 | * of address space. |
| 98 | */ |
Ricardo Ribalda Delgado | b384381 | 2010-12-07 14:27:56 +0100 | [diff] [blame] | 99 | #ifdef CONFIG_INIT_TLB |
| 100 | CONFIG_INIT_TLB (.bootpg) |
| 101 | #else |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 102 | CONFIG_BOARDDIR/init.o (.bootpg) |
Ricardo Ribalda Delgado | b384381 | 2010-12-07 14:27:56 +0100 | [diff] [blame] | 103 | #endif |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 104 | } :text = 0xffff |
| 105 | #endif |
| 106 | |
| 107 | .resetvec RESET_VECTOR_ADDRESS : |
| 108 | { |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 109 | KEEP(*(.resetvec)) |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 110 | } :text = 0xffff |
| 111 | |
| 112 | . = RESET_VECTOR_ADDRESS + 0x4; |
| 113 | |
| 114 | /* |
| 115 | * Make sure that the bss segment isn't linked at 0x0, otherwise its |
| 116 | * address won't be updated during relocation fixups. Note that |
| 117 | * this is a temporary fix. Code to dynamically the fixup the bss |
| 118 | * location will be added in the future. When the bss relocation |
| 119 | * fixup code is present this workaround should be removed. |
| 120 | */ |
| 121 | #if (RESET_VECTOR_ADDRESS == 0xfffffffc) |
| 122 | . |= 0x10; |
| 123 | #endif |
Stefan Roese | 07038ad | 2013-04-02 10:37:04 +0200 | [diff] [blame] | 124 | #endif /* CONFIG_SPL */ |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 125 | |
| 126 | __bss_start = .; |
| 127 | .bss (NOLOAD) : |
| 128 | { |
Wolfgang Denk | fe33e6e | 2010-11-21 20:55:42 +0100 | [diff] [blame] | 129 | *(.bss*) |
| 130 | *(.sbss*) |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 131 | *(COMMON) |
| 132 | } :bss |
| 133 | |
| 134 | . = ALIGN(4); |
Simon Glass | ed70c8f | 2013-03-14 06:54:53 +0000 | [diff] [blame] | 135 | __bss_end = . ; |
Stefan Roese | 90c932b | 2009-10-27 16:11:26 +0100 | [diff] [blame] | 136 | PROVIDE (end = .); |
| 137 | } |