ARM: HYP/non-sec: add separate section for secure code
In anticipation of refactoring the HYP/non-secure code to run from secure RAM, add a new linker section that will contain that code. Nothing is using it just yet. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
This commit is contained in:
committed by
Albert ARIBAUD
parent
b726d22da9
commit
bf433afd60
@@ -113,7 +113,7 @@ endif
|
|||||||
ifdef CONFIG_ARM64
|
ifdef CONFIG_ARM64
|
||||||
OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
|
OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
|
||||||
else
|
else
|
||||||
OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
|
OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_OF_EMBED
|
ifdef CONFIG_OF_EMBED
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
* SPDX-License-Identifier: GPL-2.0+
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
OUTPUT_ARCH(arm)
|
OUTPUT_ARCH(arm)
|
||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
@@ -23,6 +25,34 @@ SECTIONS
|
|||||||
*(.text*)
|
*(.text*)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT) || defined(CONFIG_ARMV7_PSCI)
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARMV7_SECURE_BASE
|
||||||
|
#define CONFIG_ARMV7_SECURE_BASE
|
||||||
|
#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);
|
||||||
|
|
||||||
|
__secure_end_lma = .;
|
||||||
|
.__secure_end : AT(__secure_end_lma) {
|
||||||
|
*(.__secure_end)
|
||||||
|
LONG(0x1d1071c); /* Must output something to reset LMA */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
|
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
|
||||||
|
|
||||||
|
|||||||
@@ -25,4 +25,6 @@ char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
|
|||||||
char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
|
char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
|
||||||
char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
|
char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
|
||||||
char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
|
char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
|
||||||
|
char __secure_start[0] __attribute__((section(".__secure_start")));
|
||||||
|
char __secure_end[0] __attribute__((section(".__secure_end")));
|
||||||
char _end[0] __attribute__((section(".__end")));
|
char _end[0] __attribute__((section(".__end")));
|
||||||
|
|||||||
Reference in New Issue
Block a user