summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2018-08-28 11:13:55 +0100
committerSoby Mathew <soby.mathew@arm.com>2018-10-29 09:54:31 +0000
commit3bd17c0fef46a7cd894974ac4c996801458f6d09 (patch)
tree0e880caf9e19ce8863399087b3e0daaa069414f4 /Makefile
parent6a7b30057806c3573ee0194b7aa583bd60c89371 (diff)
Basic Makefile changes for PIE
Change-Id: I0b8ccba15024c55bb03927cdb50370913eb8010c Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 12 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index be543fac..74d51804 100644
--- a/Makefile
+++ b/Makefile
@@ -205,11 +205,6 @@ TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \
-Os -ffunction-sections -fdata-sections
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
-PIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT})
-
-ifneq ($(PIE_FOUND),)
-TF_CFLAGS += -fno-PIE
-endif
# Force the compiler to include the frame pointer
ifeq (${ENABLE_BACKTRACE},1)
@@ -335,6 +330,16 @@ ifeq (${ARM_ARCH_MAJOR},7)
include make_helpers/armv7-a-cpus.mk
endif
+ifeq ($(ENABLE_PIE),1)
+ TF_CFLAGS += -fpie
+ TF_LDFLAGS += -pie
+else
+ PIE_FOUND := $(findstring --enable-default-pie,${GCC_V_OUTPUT})
+ ifneq ($(PIE_FOUND),)
+ TF_CFLAGS += -fno-PIE
+ endif
+endif
+
# Include the CPU specific operations makefile, which provides default
# values for all CPU errata workarounds and CPU specific optimisations.
# This can be overridden by the platform.
@@ -565,6 +570,7 @@ $(eval $(call assert_boolean,ENABLE_AMU))
$(eval $(call assert_boolean,ENABLE_ASSERTIONS))
$(eval $(call assert_boolean,ENABLE_BACKTRACE))
$(eval $(call assert_boolean,ENABLE_MPAM_FOR_LOWER_ELS))
+$(eval $(call assert_boolean,ENABLE_PIE))
$(eval $(call assert_boolean,ENABLE_PMF))
$(eval $(call assert_boolean,ENABLE_PSCI_STAT))
$(eval $(call assert_boolean,ENABLE_RUNTIME_INSTRUMENTATION))
@@ -615,6 +621,7 @@ $(eval $(call add_define,ENABLE_AMU))
$(eval $(call add_define,ENABLE_ASSERTIONS))
$(eval $(call add_define,ENABLE_BACKTRACE))
$(eval $(call add_define,ENABLE_MPAM_FOR_LOWER_ELS))
+$(eval $(call add_define,ENABLE_PIE))
$(eval $(call add_define,ENABLE_PMF))
$(eval $(call add_define,ENABLE_PSCI_STAT))
$(eval $(call add_define,ENABLE_RUNTIME_INSTRUMENTATION))