Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2004-2008 Texas Instruments |
| 3 | * |
| 4 | * (C) Copyright 2002 |
| 5 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
| 6 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 10 | #include <config.h> |
| 11 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 12 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") |
| 13 | OUTPUT_ARCH(arm) |
| 14 | ENTRY(_start) |
| 15 | SECTIONS |
| 16 | { |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 17 | /* |
| 18 | * Discard the relocation entries for secure text. |
| 19 | * The secure code is bundled with u-boot image, so there will |
| 20 | * be relocations entries for the secure code, since we use |
| 21 | * "-mword-relocations" to compile and "-pie" to link into the |
| 22 | * final image. We do not need the relocation entries for secure |
| 23 | * code, because secure code will not be relocated, it only needs |
| 24 | * to be copied from loading address to CONFIG_ARMV7_SECURE_BASE, |
| 25 | * which is the linking and running address for secure code. |
| 26 | * If keep the relocation entries in .rel.dyn section, |
| 27 | * "relocation offset + linking address" may locates into an |
| 28 | * address that is reserved by SoC, then will trigger data abort. |
| 29 | * |
| 30 | * The reason that move .rel._secure at the beginning, is to |
| 31 | * avoid hole in the final image. |
| 32 | */ |
| 33 | /DISCARD/ : { *(.rel._secure*) } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 34 | . = 0x00000000; |
| 35 | |
| 36 | . = ALIGN(4); |
| 37 | .text : |
| 38 | { |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 39 | *(.__image_copy_start) |
Albert ARIBAUD | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 40 | *(.vectors) |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 41 | CPUDIR/start.o (.text*) |
| 42 | *(.text*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 43 | } |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 44 | |
Jan Kiszka | ac31b5a | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 45 | #ifdef CONFIG_ARMV7_NONSEC |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 46 | |
| 47 | #ifndef CONFIG_ARMV7_SECURE_BASE |
| 48 | #define CONFIG_ARMV7_SECURE_BASE |
| 49 | #endif |
| 50 | |
| 51 | .__secure_start : { |
| 52 | . = ALIGN(0x1000); |
| 53 | *(.__secure_start) |
| 54 | } |
| 55 | |
| 56 | .secure_text CONFIG_ARMV7_SECURE_BASE : |
| 57 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 58 | { |
| 59 | *(._secure.text) |
| 60 | } |
| 61 | |
| 62 | . = LOADADDR(.__secure_start) + |
| 63 | SIZEOF(.__secure_start) + |
| 64 | SIZEOF(.secure_text); |
| 65 | |
| 66 | __secure_end_lma = .; |
| 67 | .__secure_end : AT(__secure_end_lma) { |
| 68 | *(.__secure_end) |
| 69 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 70 | } |
| 71 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 72 | |
| 73 | . = ALIGN(4); |
| 74 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 75 | |
| 76 | . = ALIGN(4); |
| 77 | .data : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 78 | *(.data*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | . = ALIGN(4); |
| 82 | |
| 83 | . = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 84 | |
| 85 | . = ALIGN(4); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 86 | .u_boot_list : { |
Albert ARIBAUD | c24895e | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 87 | KEEP(*(SORT(.u_boot_list*))); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | . = ALIGN(4); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 91 | |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 92 | .image_copy_end : |
| 93 | { |
| 94 | *(.__image_copy_end) |
| 95 | } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 96 | |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 97 | .rel_dyn_start : |
| 98 | { |
| 99 | *(.__rel_dyn_start) |
| 100 | } |
| 101 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 102 | .rel.dyn : { |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 103 | *(.rel*) |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | .rel_dyn_end : |
| 107 | { |
| 108 | *(.__rel_dyn_end) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 111 | .end : |
| 112 | { |
| 113 | *(.__end) |
| 114 | } |
| 115 | |
| 116 | _image_binary_end = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 117 | |
| 118 | /* |
| 119 | * Deprecated: this MMU section is used by pxa at present but |
| 120 | * should not be used by new boards/CPUs. |
| 121 | */ |
| 122 | . = ALIGN(4096); |
| 123 | .mmutable : { |
| 124 | *(.mmutable) |
| 125 | } |
| 126 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 127 | /* |
| 128 | * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c |
| 129 | * __bss_base and __bss_limit are for linker only (overlay ordering) |
| 130 | */ |
| 131 | |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 132 | .bss_start __rel_dyn_start (OVERLAY) : { |
| 133 | KEEP(*(.__bss_start)); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 134 | __bss_base = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 135 | } |
| 136 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 137 | .bss __bss_base (OVERLAY) : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 138 | *(.bss*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 139 | . = ALIGN(4); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 140 | __bss_limit = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 141 | } |
Tom Rini | 19aac97 | 2013-03-18 12:31:00 -0400 | [diff] [blame] | 142 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 143 | .bss_end __bss_limit (OVERLAY) : { |
| 144 | KEEP(*(.__bss_end)); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 145 | } |
| 146 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 147 | .dynsym _image_binary_end : { *(.dynsym) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 148 | .dynbss : { *(.dynbss) } |
| 149 | .dynstr : { *(.dynstr*) } |
| 150 | .dynamic : { *(.dynamic*) } |
| 151 | .plt : { *(.plt*) } |
| 152 | .interp : { *(.interp*) } |
Andreas Färber | 438a167 | 2014-01-27 05:48:11 +0100 | [diff] [blame] | 153 | .gnu.hash : { *(.gnu.hash) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 154 | .gnu : { *(.gnu*) } |
| 155 | .ARM.exidx : { *(.ARM.exidx*) } |
Albert ARIBAUD | ddadbed | 2014-01-13 14:57:05 +0100 | [diff] [blame] | 156 | .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 157 | } |