aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Deprez <olivier.deprez@arm.com>2020-02-03 11:27:01 +0100
committerOlivier Deprez <olivier.deprez@arm.com>2020-03-23 10:19:59 +0100
commit231115da2736e7e36627a02497815f33f022cc57 (patch)
tree6f66582ae47887b3cf545ae603ba08c57a1ebbfd
parentafcdb7ce1a76978f001be8e8e162c20f71868753 (diff)
downloadtf-a-tests-231115da2736e7e36627a02497815f33f022cc57.tar.gz
cactus: update build options and memory map to make it PIE
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: I9287361d2a4c81954fae715fef6ba5cc57cc10e0
-rw-r--r--Makefile12
-rw-r--r--spm/cactus/cactus_def.h4
2 files changed, 12 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 010496d6a..dc6092ff1 100644
--- a/Makefile
+++ b/Makefile
@@ -223,6 +223,14 @@ NS_BL1U_CFLAGS += -mbranch-protection=pac-ret
NS_BL2U_CFLAGS += -mbranch-protection=pac-ret
endif
+#####################################################################################
+ifneq ($(findstring gcc,$(notdir $(LD))),)
+ PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker
+else
+ PIE_LDFLAGS += -pie --no-dynamic-linker
+endif
+
+#####################################################################################
NS_BL1U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS}
NS_BL1U_INCLUDES += ${PLAT_INCLUDES}
NS_BL1U_CFLAGS += ${COMMON_CFLAGS}
@@ -243,9 +251,9 @@ CACTUS_MM_LDFLAGS += ${COMMON_LDFLAGS}
CACTUS_SOURCES += ${LIBC_SRCS}
CACTUS_INCLUDES += ${PLAT_INCLUDES}
-CACTUS_CFLAGS += ${COMMON_CFLAGS}
+CACTUS_CFLAGS += ${COMMON_CFLAGS} -fpie
CACTUS_ASFLAGS += ${COMMON_ASFLAGS}
-CACTUS_LDFLAGS += ${COMMON_LDFLAGS}
+CACTUS_LDFLAGS += ${COMMON_LDFLAGS} $(PIE_LDFLAGS)
IVY_SOURCES += ${LIBC_SRCS}
IVY_INCLUDES += ${PLAT_INCLUDES}
diff --git a/spm/cactus/cactus_def.h b/spm/cactus/cactus_def.h
index 13b5dac60..e865036d8 100644
--- a/spm/cactus/cactus_def.h
+++ b/spm/cactus/cactus_def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,7 +14,7 @@
*/
/* Up to 2 MiB at an arbitrary address that doesn't overlap the devices. */
-#define CACTUS_IMAGE_BASE ULL(0x80000000)
+#define CACTUS_IMAGE_BASE ULL(0x1000)
#define CACTUS_IMAGE_SIZE ULL(0x200000)
/* Memory reserved for stacks */