Add fPIE flag
libvboot_host.a is needed by metrics, compiled in platform's gyp/ninja system.
All platform executables need to be position independent so we need
libvboot_host.a to be position independent too.
BRANCH=None
BUG=chromium:389742
TEST=Unittests.
TEST=Build vboot_reference and metrics, metrics compiles.
TEST=Build coreboot on a rambi, the compilation succeeds.
TEST=trybot run on daisy, link, duck, rambi and x86-mario.
Change-Id: I4b761d9435c35e3d3fcae2efc72fcaed7fc746a6
Reviewed-on: https://chromium-review.googlesource.com/206055
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/Makefile b/Makefile
index 60509f6..2fb59cc 100644
--- a/Makefile
+++ b/Makefile
@@ -162,6 +162,11 @@
# Create / use dependency files
CFLAGS += -MMD -MF $@.d
+ifeq (${FIRMWARE_ARCH},)
+# Creates position independent code for non firmware target.
+CFLAGS += -fPIE
+endif
+
# These are required to access large disks and files on 32-bit systems.
CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64