From ce5d0580f8ec4b8a154db400e71115cddf14d112 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 29 Jul 2005 03:44:35 +0000 Subject: finish cleaning up the PIE flag checks --- Rules.mak | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Rules.mak b/Rules.mak index edba76251..d85b26134 100644 --- a/Rules.mak +++ b/Rules.mak @@ -115,8 +115,7 @@ ARFLAGS:=cr OPTIMIZATION:= PICFLAG:=-fPIC - -PIEFLAG:=$(call check_gcc,-fPIE,) +PIEFLAG_NAME:=-fPIE # Some nice CPU specific optimizations ifeq ($(strip $(TARGET_ARCH)),i386) @@ -207,7 +206,7 @@ ifeq ($(strip $(TARGET_ARCH)),cris) CPU_LDFLAGS-$(CONFIG_CRIS)+=-mcrislinux CPU_CFLAGS-$(CONFIG_CRIS)+=-mlinux PICFLAG:=-fpic - PIEFLAG:=$(call check_gcc,-fpie,) + PIEFLAG_NAME:=-fpie endif ifeq ($(strip $(TARGET_ARCH)),powerpc) @@ -215,27 +214,26 @@ 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,) + PIEFLAG_NAME:=-fpie endif ifeq ($(strip $(TARGET_ARCH)),frv) CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic - # 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 - # and calls through PLTs, dynamic resolution of symbols, etc, - # which would break as well, but -Bsymbolic comes to the rescue. - LDPIEFLAG=-shared -Bsymbolic UCLIBC_LDSO=ld.so.1 endif +ifneq ($(UCLIBC_BUILD_PIE),y) +PIEFLAG:= +else +PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),) +endif + # Use '-Os' optimization if available, else use -O2, allow Config to override OPTIMIZATION+=$(call check_gcc,-Os,-O2) # Use the gcc 3.4 -funit-at-a-time optimization when available OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,) - # Add a bunch of extra pedantic annoyingly strict checks XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS))) @@ -255,11 +253,6 @@ ifeq ($(strip $(TARGET_ARCH)),arm) endif endif -ifneq ($(UCLIBC_BUILD_PIE),y) -PIEFLAG= -LDPIEFLAG= -endif - SSP_DISABLE_FLAGS:=$(call check_gcc,-fno-stack-protector,) ifeq ($(UCLIBC_BUILD_SSP),y) SSP_CFLAGS:=$(call check_gcc,-fno-stack-protector-all,) -- cgit v1.2.3