|
@@ -153,15 +153,14 @@ TOOLCHAIN_EXTERNAL_CROSS = $(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX
|
|
TOOLCHAIN_EXTERNAL_CC = $(TOOLCHAIN_EXTERNAL_CROSS)gcc
|
|
TOOLCHAIN_EXTERNAL_CC = $(TOOLCHAIN_EXTERNAL_CROSS)gcc
|
|
TOOLCHAIN_EXTERNAL_CXX = $(TOOLCHAIN_EXTERNAL_CROSS)g++
|
|
TOOLCHAIN_EXTERNAL_CXX = $(TOOLCHAIN_EXTERNAL_CROSS)g++
|
|
TOOLCHAIN_EXTERNAL_READELF = $(TOOLCHAIN_EXTERNAL_CROSS)readelf
|
|
TOOLCHAIN_EXTERNAL_READELF = $(TOOLCHAIN_EXTERNAL_CROSS)readelf
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
|
|
|
|
|
|
|
|
ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),)
|
|
ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),)
|
|
# TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path
|
|
# TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += \
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \
|
|
-DBR_CROSS_PATH_ABS='"$(TOOLCHAIN_EXTERNAL_BIN)"'
|
|
-DBR_CROSS_PATH_ABS='"$(TOOLCHAIN_EXTERNAL_BIN)"'
|
|
else
|
|
else
|
|
# TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path
|
|
# TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += \
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \
|
|
-DBR_CROSS_PATH_REL='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"'
|
|
-DBR_CROSS_PATH_REL='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"'
|
|
endif
|
|
endif
|
|
|
|
|
|
@@ -180,59 +179,54 @@ CC_TARGET_MODE_ := $(call qstrip,$(BR2_GCC_TARGET_MODE))
|
|
# to select the right multilib variant
|
|
# to select the right multilib variant
|
|
ifeq ($(BR2_x86_64),y)
|
|
ifeq ($(BR2_x86_64),y)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -m64
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -m64
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_64
|
|
endif
|
|
endif
|
|
ifneq ($(CC_TARGET_ARCH_),)
|
|
ifneq ($(CC_TARGET_ARCH_),)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
|
|
endif
|
|
endif
|
|
ifneq ($(CC_TARGET_CPU_),)
|
|
ifneq ($(CC_TARGET_CPU_),)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
|
|
endif
|
|
endif
|
|
ifneq ($(CC_TARGET_ABI_),)
|
|
ifneq ($(CC_TARGET_ABI_),)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
|
|
endif
|
|
endif
|
|
ifneq ($(CC_TARGET_FPU_),)
|
|
ifneq ($(CC_TARGET_FPU_),)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=$(CC_TARGET_FPU_)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=$(CC_TARGET_FPU_)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_FPU='"$(CC_TARGET_FPU_)"'
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FPU='"$(CC_TARGET_FPU_)"'
|
|
endif
|
|
endif
|
|
ifneq ($(CC_TARGET_FLOAT_ABI_),)
|
|
ifneq ($(CC_TARGET_FLOAT_ABI_),)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"'
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"'
|
|
endif
|
|
endif
|
|
ifneq ($(CC_TARGET_MODE_),)
|
|
ifneq ($(CC_TARGET_MODE_),)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"'
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"'
|
|
endif
|
|
endif
|
|
ifeq ($(BR2_BINFMT_FLAT),y)
|
|
ifeq ($(BR2_BINFMT_FLAT),y)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_BINFMT_FLAT
|
|
endif
|
|
endif
|
|
ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
|
|
ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -EL
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -EL
|
|
endif
|
|
endif
|
|
ifeq ($(BR2_mips)$(BR2_mips64),y)
|
|
ifeq ($(BR2_mips)$(BR2_mips64),y)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -EB
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -EB
|
|
endif
|
|
endif
|
|
ifeq ($(BR2_arceb),y)
|
|
ifeq ($(BR2_arceb),y)
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ARC_TARGET_BIG_ENDIAN
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARC_TARGET_BIG_ENDIAN
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -EB
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -EB
|
|
endif
|
|
endif
|
|
-ifneq ($(BR2_TARGET_OPTIMIZATION),)
|
|
|
|
|
|
+
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
|
|
-# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each
|
|
|
|
-# flag is a separate argument when used in execv() by the external
|
|
|
|
-# toolchain wrapper.
|
|
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
|
|
|
|
-endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_SOFT_FLOAT),y)
|
|
ifeq ($(BR2_SOFT_FLOAT),y)
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
|
|
endif
|
|
endif
|
|
|
|
|
|
# The Linaro ARMhf toolchain expects the libraries in
|
|
# The Linaro ARMhf toolchain expects the libraries in
|
|
@@ -696,15 +690,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT
|
|
endef
|
|
endef
|
|
endif
|
|
endif
|
|
|
|
|
|
-# We use --hash-style=both to increase the compatibility of
|
|
|
|
-# the generated binary with older platforms, except for MIPS,
|
|
|
|
-# where the only acceptable hash style is 'sysv'
|
|
|
|
-ifeq ($(findstring mips,$(HOSTARCH)),mips)
|
|
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE = sysv
|
|
|
|
-else
|
|
|
|
-TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE = both
|
|
|
|
-endif
|
|
|
|
-
|
|
|
|
# Build toolchain wrapper for preprocessor, C and C++ compiler and setup
|
|
# Build toolchain wrapper for preprocessor, C and C++ compiler and setup
|
|
# symlinks for everything else. Skip gdb symlink when we are building our
|
|
# symlinks for everything else. Skip gdb symlink when we are building our
|
|
# own gdb to prevent two gdb's in output/host/usr/bin.
|
|
# own gdb to prevent two gdb's in output/host/usr/bin.
|
|
@@ -715,8 +700,6 @@ endif
|
|
# match the *cc-* pattern. Therefore, an additional case is added for *-ar,
|
|
# match the *cc-* pattern. Therefore, an additional case is added for *-ar,
|
|
# *-ranlib and *-nm.
|
|
# *-ranlib and *-nm.
|
|
define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
|
|
define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
|
|
- $(Q)$(call MESSAGE,"Building ext-toolchain wrapper")
|
|
|
|
- $(Q)mkdir -p $(HOST_DIR)/usr/bin
|
|
|
|
$(Q)cd $(HOST_DIR)/usr/bin; \
|
|
$(Q)cd $(HOST_DIR)/usr/bin; \
|
|
for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
|
|
for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
|
|
base=$${i##*/}; \
|
|
base=$${i##*/}; \
|
|
@@ -725,7 +708,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
|
|
ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
|
|
ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
|
|
;; \
|
|
;; \
|
|
*cc|*cc-*|*++|*++-*|*cpp) \
|
|
*cc|*cc-*|*++|*++-*|*cpp) \
|
|
- ln -sf ext-toolchain-wrapper $$base; \
|
|
|
|
|
|
+ ln -sf toolchain-wrapper $$base; \
|
|
;; \
|
|
;; \
|
|
*gdb|*gdbtui) \
|
|
*gdb|*gdbtui) \
|
|
if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
|
|
if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
|
|
@@ -737,10 +720,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
|
|
;; \
|
|
;; \
|
|
esac; \
|
|
esac; \
|
|
done
|
|
done
|
|
- $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) \
|
|
|
|
- -s -Wl,--hash-style=$(TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE) \
|
|
|
|
- toolchain/toolchain-external/ext-toolchain-wrapper.c \
|
|
|
|
- -o $(HOST_DIR)/usr/bin/ext-toolchain-wrapper
|
|
|
|
endef
|
|
endef
|
|
|
|
|
|
# This sed magic is taken from Linux headers_install.sh script.
|
|
# This sed magic is taken from Linux headers_install.sh script.
|
|
@@ -779,6 +758,8 @@ define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
|
|
fi
|
|
fi
|
|
endef
|
|
endef
|
|
|
|
|
|
|
|
+TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER)
|
|
|
|
+
|
|
define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
|
|
define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
|
|
$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
|
|
$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
|
|
$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
|
|
$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
|