summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rules.mak13
1 files changed, 12 insertions, 1 deletions
diff --git a/Rules.mak b/Rules.mak
index 72dba878f..f41adaa62 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -89,6 +89,10 @@ ARFLAGS:=r
OPTIMIZATION:=
PICFLAG:=-fPIC
+PIEFLAG:=$(call check_gcc,-fPIE,)
+ifeq ($(strip $(PIEFLAG)),-fPIE)
+LDPIEFLAG:=-Wl,-pie
+endif
# Some nice CPU specific optimizations
ifeq ($(strip $(TARGET_ARCH)),i386)
@@ -172,6 +176,7 @@ ifeq ($(strip $(TARGET_ARCH)),cris)
CPU_LDFLAGS-$(CONFIG_CRIS)+=-mcrislinux
CPU_CFLAGS-$(CONFIG_CRIS)+=-mlinux
PICFLAG:=-fpic
+ PIEFLAG:=$(call check_gcc,-fpie,)
endif
ifeq ($(strip $(TARGET_ARCH)),powerpc)
@@ -179,13 +184,14 @@ ifeq ($(strip $(TARGET_ARCH)),powerpc)
# enough. Therefore use -fpic which will reduce code size and generates
# faster code.
PICFLAG:=-fpic
+ PIEFLAG=$(call check_gcc,-fpie,)
endif
ifeq ($(strip $(TARGET_ARCH)),frv)
CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
PICFLAG=-fPIC -DPIC
- PIEFLAG=-fpie
+ PIEFLAG=$(call check_gcc,-fpie,)
# Using -pie causes the program to have an interpreter, which is
# forbidden, so we must make do with -shared. Unfortunately,
# -shared by itself would get us global function descriptors
@@ -220,6 +226,11 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
endif
endif
+ifneq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
+PIEFLAG=
+LDPIEFLAG=
+endif
+
ifeq ($(SSP_CFLAGS),)
SSP_CFLAGS=$(call check_gcc,-fno-stack-protector-all,)
SSP_CFLAGS+=$(call check_gcc,-fstack-protector,)