2012-02-23 03:28:41 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2008 Texas Instruments
|
|
|
|
*
|
|
|
|
* (C) Copyright 2002
|
|
|
|
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2012-02-23 03:28:41 +00:00
|
|
|
*/
|
|
|
|
|
2014-07-12 13:24:02 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2012-02-23 03:28:41 +00:00
|
|
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
|
|
|
OUTPUT_ARCH(arm)
|
|
|
|
ENTRY(_start)
|
|
|
|
SECTIONS
|
|
|
|
{
|
2016-03-14 01:07:29 +00:00
|
|
|
#ifndef CONFIG_CMDLINE
|
|
|
|
/DISCARD/ : { *(.u_boot_list_2_cmd_*) }
|
|
|
|
#endif
|
ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined
"DISCARD" will remove ._secure.text relocate, but PSCI framework
has already used some absolute address those need to relocate.
Use readelf -t -r u-boot show us:
.__secure_start addr: 601408e4
.__secure_end addr: 60141460
60141140 00000017 R_ARM_RELATIVE
46 _secure_monitor:
47 #ifdef CONFIG_ARMV7_PSCI
48 ldr r5, =_psci_vectors
60141194 00000017 R_ARM_RELATIVE
6014119c 00000017 R_ARM_RELATIVE
601411a4 00000017 R_ARM_RELATIVE
601411ac 00000017 R_ARM_RELATIVE
64 _psci_table:
66 .word psci_cpu_suspend
...
72 .word psci_migrate
60141344 00000017 R_ARM_RELATIVE
6014145c 00000017 R_ARM_RELATIVE
202 ldr r5, =psci_text_end
Solutions:
1. Change absolute address to RelAdr.
Based on LDR (immediate, ARM), we only have 4K offset to jump.
Now PSCI code size is close to 4K size that is LDR limit jump size,
so even if the LDR is based on the current instruction address,
there is also have a risk for RelAdr. If we use two jump steps I
think we can fix this issue, but looks too hack, so give up this way.
2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
will in the BASE address that is absolute.
Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-18 03:02:40 +00:00
|
|
|
#if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)
|
arm: discard relocation entries for secure text
The code such as PSCI in section named secure is bundled with
u-boot image, and when bootm, the code will be copied to their
runtime address same to compliation/linking address -
CONFIG_ARMV7_SECURE_BASE.
When compile the PSCI code and link it into the u-boot image,
there will be relocation entries in .rel.dyn section for PSCI.
Actually, we do not needs these relocation entries.
If still keep the relocation entries in .rel.dyn section,
r0 at line 103 and 106 in arch/arm/lib/relocate.S may be an invalid
address which may not support read/write for one SoC.
102 /* relative fix: increase location by offset */
103 add r0, r0, r4
104 ldr r1, [r0]
105 add r1, r1, r4
106 str r1, [r0]
So discard them to avoid touching the relocation entry in
arch/arm/lib/relocate.S.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: York Sun <yorksun@freescale.com>
Cc: Hans De Goede <hdegoede@redhat.com>
Cc: Ian Campbell <ijc@hellion.org.uk>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@konsulko.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2015-10-23 02:13:03 +00:00
|
|
|
/*
|
ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined
"DISCARD" will remove ._secure.text relocate, but PSCI framework
has already used some absolute address those need to relocate.
Use readelf -t -r u-boot show us:
.__secure_start addr: 601408e4
.__secure_end addr: 60141460
60141140 00000017 R_ARM_RELATIVE
46 _secure_monitor:
47 #ifdef CONFIG_ARMV7_PSCI
48 ldr r5, =_psci_vectors
60141194 00000017 R_ARM_RELATIVE
6014119c 00000017 R_ARM_RELATIVE
601411a4 00000017 R_ARM_RELATIVE
601411ac 00000017 R_ARM_RELATIVE
64 _psci_table:
66 .word psci_cpu_suspend
...
72 .word psci_migrate
60141344 00000017 R_ARM_RELATIVE
6014145c 00000017 R_ARM_RELATIVE
202 ldr r5, =psci_text_end
Solutions:
1. Change absolute address to RelAdr.
Based on LDR (immediate, ARM), we only have 4K offset to jump.
Now PSCI code size is close to 4K size that is LDR limit jump size,
so even if the LDR is based on the current instruction address,
there is also have a risk for RelAdr. If we use two jump steps I
think we can fix this issue, but looks too hack, so give up this way.
2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
will in the BASE address that is absolute.
Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-18 03:02:40 +00:00
|
|
|
* If CONFIG_ARMV7_SECURE_BASE is true, secure code will not
|
|
|
|
* bundle with u-boot, and code offsets are fixed. Secure zone
|
|
|
|
* only needs to be copied from the loading address to
|
|
|
|
* CONFIG_ARMV7_SECURE_BASE, which is the linking and running
|
|
|
|
* address for secure code.
|
arm: discard relocation entries for secure text
The code such as PSCI in section named secure is bundled with
u-boot image, and when bootm, the code will be copied to their
runtime address same to compliation/linking address -
CONFIG_ARMV7_SECURE_BASE.
When compile the PSCI code and link it into the u-boot image,
there will be relocation entries in .rel.dyn section for PSCI.
Actually, we do not needs these relocation entries.
If still keep the relocation entries in .rel.dyn section,
r0 at line 103 and 106 in arch/arm/lib/relocate.S may be an invalid
address which may not support read/write for one SoC.
102 /* relative fix: increase location by offset */
103 add r0, r0, r4
104 ldr r1, [r0]
105 add r1, r1, r4
106 str r1, [r0]
So discard them to avoid touching the relocation entry in
arch/arm/lib/relocate.S.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: York Sun <yorksun@freescale.com>
Cc: Hans De Goede <hdegoede@redhat.com>
Cc: Ian Campbell <ijc@hellion.org.uk>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@konsulko.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2015-10-23 02:13:03 +00:00
|
|
|
*
|
ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined
"DISCARD" will remove ._secure.text relocate, but PSCI framework
has already used some absolute address those need to relocate.
Use readelf -t -r u-boot show us:
.__secure_start addr: 601408e4
.__secure_end addr: 60141460
60141140 00000017 R_ARM_RELATIVE
46 _secure_monitor:
47 #ifdef CONFIG_ARMV7_PSCI
48 ldr r5, =_psci_vectors
60141194 00000017 R_ARM_RELATIVE
6014119c 00000017 R_ARM_RELATIVE
601411a4 00000017 R_ARM_RELATIVE
601411ac 00000017 R_ARM_RELATIVE
64 _psci_table:
66 .word psci_cpu_suspend
...
72 .word psci_migrate
60141344 00000017 R_ARM_RELATIVE
6014145c 00000017 R_ARM_RELATIVE
202 ldr r5, =psci_text_end
Solutions:
1. Change absolute address to RelAdr.
Based on LDR (immediate, ARM), we only have 4K offset to jump.
Now PSCI code size is close to 4K size that is LDR limit jump size,
so even if the LDR is based on the current instruction address,
there is also have a risk for RelAdr. If we use two jump steps I
think we can fix this issue, but looks too hack, so give up this way.
2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
will in the BASE address that is absolute.
Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-18 03:02:40 +00:00
|
|
|
* If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will
|
|
|
|
* be included in u-boot address space, and some absolute address
|
|
|
|
* were used in secure code. The absolute addresses of the secure
|
|
|
|
* code also needs to be relocated along with the accompanying u-boot
|
|
|
|
* code.
|
|
|
|
*
|
|
|
|
* So DISCARD is only for CONFIG_ARMV7_SECURE_BASE.
|
arm: discard relocation entries for secure text
The code such as PSCI in section named secure is bundled with
u-boot image, and when bootm, the code will be copied to their
runtime address same to compliation/linking address -
CONFIG_ARMV7_SECURE_BASE.
When compile the PSCI code and link it into the u-boot image,
there will be relocation entries in .rel.dyn section for PSCI.
Actually, we do not needs these relocation entries.
If still keep the relocation entries in .rel.dyn section,
r0 at line 103 and 106 in arch/arm/lib/relocate.S may be an invalid
address which may not support read/write for one SoC.
102 /* relative fix: increase location by offset */
103 add r0, r0, r4
104 ldr r1, [r0]
105 add r1, r1, r4
106 str r1, [r0]
So discard them to avoid touching the relocation entry in
arch/arm/lib/relocate.S.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: York Sun <yorksun@freescale.com>
Cc: Hans De Goede <hdegoede@redhat.com>
Cc: Ian Campbell <ijc@hellion.org.uk>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@konsulko.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2015-10-23 02:13:03 +00:00
|
|
|
*/
|
|
|
|
/DISCARD/ : { *(.rel._secure*) }
|
ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined
"DISCARD" will remove ._secure.text relocate, but PSCI framework
has already used some absolute address those need to relocate.
Use readelf -t -r u-boot show us:
.__secure_start addr: 601408e4
.__secure_end addr: 60141460
60141140 00000017 R_ARM_RELATIVE
46 _secure_monitor:
47 #ifdef CONFIG_ARMV7_PSCI
48 ldr r5, =_psci_vectors
60141194 00000017 R_ARM_RELATIVE
6014119c 00000017 R_ARM_RELATIVE
601411a4 00000017 R_ARM_RELATIVE
601411ac 00000017 R_ARM_RELATIVE
64 _psci_table:
66 .word psci_cpu_suspend
...
72 .word psci_migrate
60141344 00000017 R_ARM_RELATIVE
6014145c 00000017 R_ARM_RELATIVE
202 ldr r5, =psci_text_end
Solutions:
1. Change absolute address to RelAdr.
Based on LDR (immediate, ARM), we only have 4K offset to jump.
Now PSCI code size is close to 4K size that is LDR limit jump size,
so even if the LDR is based on the current instruction address,
there is also have a risk for RelAdr. If we use two jump steps I
think we can fix this issue, but looks too hack, so give up this way.
2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
will in the BASE address that is absolute.
Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-18 03:02:40 +00:00
|
|
|
#endif
|
2012-02-23 03:28:41 +00:00
|
|
|
. = 0x00000000;
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
.text :
|
|
|
|
{
|
2013-06-11 12:17:33 +00:00
|
|
|
*(.__image_copy_start)
|
2014-04-15 14:13:51 +00:00
|
|
|
*(.vectors)
|
2012-10-22 06:19:32 +00:00
|
|
|
CPUDIR/start.o (.text*)
|
|
|
|
*(.text*)
|
2012-02-23 03:28:41 +00:00
|
|
|
}
|
|
|
|
|
2015-04-21 05:18:24 +00:00
|
|
|
#ifdef CONFIG_ARMV7_NONSEC
|
2014-07-12 13:24:02 +00:00
|
|
|
|
|
|
|
#ifndef CONFIG_ARMV7_SECURE_BASE
|
|
|
|
#define CONFIG_ARMV7_SECURE_BASE
|
2016-06-07 02:54:27 +00:00
|
|
|
#define __ARMV7_PSCI_STACK_IN_RAM
|
2014-07-12 13:24:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
.__secure_start : {
|
|
|
|
. = ALIGN(0x1000);
|
|
|
|
*(.__secure_start)
|
|
|
|
}
|
|
|
|
|
|
|
|
.secure_text CONFIG_ARMV7_SECURE_BASE :
|
|
|
|
AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
|
|
|
|
{
|
|
|
|
*(._secure.text)
|
|
|
|
}
|
|
|
|
|
|
|
|
. = LOADADDR(.__secure_start) +
|
|
|
|
SIZEOF(.__secure_start) +
|
|
|
|
SIZEOF(.secure_text);
|
|
|
|
|
2016-06-07 02:54:27 +00:00
|
|
|
#ifdef __ARMV7_PSCI_STACK_IN_RAM
|
|
|
|
/* Align to page boundary and skip 2 pages */
|
|
|
|
. = (. & ~ 0xfff) + 0x2000;
|
|
|
|
#undef __ARMV7_PSCI_STACK_IN_RAM
|
|
|
|
#endif
|
|
|
|
|
2014-07-12 13:24:02 +00:00
|
|
|
__secure_end_lma = .;
|
|
|
|
.__secure_end : AT(__secure_end_lma) {
|
|
|
|
*(.__secure_end)
|
|
|
|
LONG(0x1d1071c); /* Must output something to reset LMA */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-02-23 03:28:41 +00:00
|
|
|
. = ALIGN(4);
|
|
|
|
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
.data : {
|
2012-10-22 06:19:32 +00:00
|
|
|
*(.data*)
|
2012-02-23 03:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
|
|
|
. = .;
|
|
|
|
|
2012-10-12 10:27:03 +00:00
|
|
|
. = ALIGN(4);
|
|
|
|
.u_boot_list : {
|
2013-02-25 00:59:00 +00:00
|
|
|
KEEP(*(SORT(.u_boot_list*)));
|
2012-10-12 10:27:03 +00:00
|
|
|
}
|
|
|
|
|
2012-02-23 03:28:41 +00:00
|
|
|
. = ALIGN(4);
|
|
|
|
|
2016-03-04 00:10:01 +00:00
|
|
|
.__efi_runtime_start : {
|
|
|
|
*(.__efi_runtime_start)
|
|
|
|
}
|
|
|
|
|
|
|
|
.efi_runtime : {
|
|
|
|
*(efi_runtime_text)
|
|
|
|
*(efi_runtime_data)
|
|
|
|
}
|
|
|
|
|
|
|
|
.__efi_runtime_stop : {
|
|
|
|
*(.__efi_runtime_stop)
|
|
|
|
}
|
|
|
|
|
|
|
|
.efi_runtime_rel_start :
|
|
|
|
{
|
|
|
|
*(.__efi_runtime_rel_start)
|
|
|
|
}
|
|
|
|
|
|
|
|
.efi_runtime_rel : {
|
|
|
|
*(.relefi_runtime_text)
|
|
|
|
*(.relefi_runtime_data)
|
|
|
|
}
|
|
|
|
|
|
|
|
.efi_runtime_rel_stop :
|
|
|
|
{
|
|
|
|
*(.__efi_runtime_rel_stop)
|
|
|
|
}
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
2013-06-11 12:17:33 +00:00
|
|
|
.image_copy_end :
|
|
|
|
{
|
|
|
|
*(.__image_copy_end)
|
|
|
|
}
|
2012-02-23 03:28:41 +00:00
|
|
|
|
2013-06-11 12:17:34 +00:00
|
|
|
.rel_dyn_start :
|
|
|
|
{
|
|
|
|
*(.__rel_dyn_start)
|
|
|
|
}
|
|
|
|
|
2012-02-23 03:28:41 +00:00
|
|
|
.rel.dyn : {
|
|
|
|
*(.rel*)
|
2013-06-11 12:17:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.rel_dyn_end :
|
|
|
|
{
|
|
|
|
*(.__rel_dyn_end)
|
2012-02-23 03:28:41 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 16:53:42 +00:00
|
|
|
.end :
|
|
|
|
{
|
|
|
|
*(.__end)
|
|
|
|
}
|
|
|
|
|
|
|
|
_image_binary_end = .;
|
2012-02-23 03:28:41 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Deprecated: this MMU section is used by pxa at present but
|
|
|
|
* should not be used by new boards/CPUs.
|
|
|
|
*/
|
|
|
|
. = ALIGN(4096);
|
|
|
|
.mmutable : {
|
|
|
|
*(.mmutable)
|
|
|
|
}
|
|
|
|
|
2013-04-11 05:43:21 +00:00
|
|
|
/*
|
|
|
|
* Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
|
|
|
|
* __bss_base and __bss_limit are for linker only (overlay ordering)
|
|
|
|
*/
|
|
|
|
|
2013-02-25 00:58:59 +00:00
|
|
|
.bss_start __rel_dyn_start (OVERLAY) : {
|
|
|
|
KEEP(*(.__bss_start));
|
2013-04-11 05:43:21 +00:00
|
|
|
__bss_base = .;
|
2013-02-25 00:58:59 +00:00
|
|
|
}
|
|
|
|
|
2013-04-11 05:43:21 +00:00
|
|
|
.bss __bss_base (OVERLAY) : {
|
2012-10-22 06:19:32 +00:00
|
|
|
*(.bss*)
|
2012-02-23 03:28:41 +00:00
|
|
|
. = ALIGN(4);
|
2013-04-11 05:43:21 +00:00
|
|
|
__bss_limit = .;
|
2013-02-25 00:58:59 +00:00
|
|
|
}
|
2013-03-18 16:31:00 +00:00
|
|
|
|
2013-04-11 05:43:21 +00:00
|
|
|
.bss_end __bss_limit (OVERLAY) : {
|
|
|
|
KEEP(*(.__bss_end));
|
2012-02-23 03:28:41 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 16:53:42 +00:00
|
|
|
.dynsym _image_binary_end : { *(.dynsym) }
|
2013-11-07 13:21:46 +00:00
|
|
|
.dynbss : { *(.dynbss) }
|
|
|
|
.dynstr : { *(.dynstr*) }
|
|
|
|
.dynamic : { *(.dynamic*) }
|
|
|
|
.plt : { *(.plt*) }
|
|
|
|
.interp : { *(.interp*) }
|
2014-01-27 04:48:11 +00:00
|
|
|
.gnu.hash : { *(.gnu.hash) }
|
2013-11-07 13:21:46 +00:00
|
|
|
.gnu : { *(.gnu*) }
|
|
|
|
.ARM.exidx : { *(.ARM.exidx*) }
|
2014-01-13 13:57:05 +00:00
|
|
|
.gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
|
2012-02-23 03:28:41 +00:00
|
|
|
}
|