]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(pie): pass `-fpie` to the preprocessor as well
authorChris Kay <chris.kay@arm.com>
Thu, 2 Feb 2023 14:39:03 +0000 (14:39 +0000)
committerChris Kay <chris.kay@arm.com>
Fri, 10 Feb 2023 17:01:46 +0000 (17:01 +0000)
When PIE is enabled, the `-fpie` flag is passed to the compiler but not
to the preprocessor. This change ensures that both tools are aware of
when the image is position-independent when preprocessing, which impacts
some pre-defined preprocessor definitions.

Change-Id: I5208a591d60ee01312f6bf3dd7343abe6535ee61
Signed-off-by: Chris Kay <chris.kay@arm.com>
Makefile

index e2922a2902766e8c54b888df9c32a6e30255bdbe..0360851b2db0987343ceb95d881430979c87e81a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -654,12 +654,16 @@ endif
 ifeq ($(ENABLE_PIE),1)
 ifeq ($(BL2_AT_EL3),1)
 ifneq ($(BL2_IN_XIP_MEM),1)
+       BL2_CPPFLAGS    +=      -fpie
        BL2_CFLAGS      +=      -fpie
        BL2_LDFLAGS     +=      $(PIE_LDFLAGS)
 endif
 endif
-       BL31_CFLAGS     +=      -fpie
+       BL31_CPPFLAGS   +=      -fpie
+       BL31_CFLAGS     +=      -fpie
        BL31_LDFLAGS    +=      $(PIE_LDFLAGS)
+
+       BL32_CPPFLAGS   +=      -fpie
        BL32_CFLAGS     +=      -fpie
        BL32_LDFLAGS    +=      $(PIE_LDFLAGS)
 endif