summaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-29 04:58:15 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-29 04:58:15 +0000
commit8c9cfb760f9b4deb0e0eb5cb9ae1969985c1cb1e (patch)
treef51a7f7a953cf33f2838debf47a5dbdefe1ee893 /Rules.mak
parentce5d0580f8ec4b8a154db400e71115cddf14d112 (diff)
export PIEFLAG and the noexecstack AS test so that gcc/as arent executed in every subdir
Diffstat (limited to 'Rules.mak')
-rw-r--r--Rules.mak21
1 files changed, 16 insertions, 5 deletions
diff --git a/Rules.mak b/Rules.mak
index d85b26134..dfeecfe2c 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -89,9 +89,11 @@ CROSS=$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
endif
# A nifty macro to make testing gcc features easier
-check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
+check_gcc=$(shell \
+ if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi)
-check_as=$(shell if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
+check_as=$(shell \
+ if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
then echo "-Wa,$(1)"; fi)
# Setup some shortcuts so that silent mode is silent like it should be
@@ -223,10 +225,13 @@ ifeq ($(strip $(TARGET_ARCH)),frv)
UCLIBC_LDSO=ld.so.1
endif
+# Keep the check_gcc from being needlessly executed
+ifndef PIEFLAG
ifneq ($(UCLIBC_BUILD_PIE),y)
-PIEFLAG:=
+export PIEFLAG:=
else
-PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),)
+export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),)
+endif
endif
# Use '-Os' optimization if available, else use -O2, allow Config to override
@@ -312,10 +317,16 @@ ifeq ($(DL_FINI_CRT_COMPAT),y)
CFLAGS += -D_DL_FINI_CRT_COMPAT
endif
+# Keep the check_as from being needlessly executed
ASFLAGS = $(CFLAGS)
+ifndef ASFLAGS_NOEXEC
ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
-ASFLAGS += $(call check_as,--noexecstack)
+export ASFLAGS_NOEXEC := $(call check_as,--noexecstack)
+else
+export ASFLAGS_NOEXEC :=
+endif
endif
+ASFLAGS += $(ASFLAGS_NOEXEC)
LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)