1 ################################################################################
3 # definition of the toolchain wrapper build commands
5 ################################################################################
7 # We use --hash-style=both to increase the compatibility of the generated
8 # binary with older platforms, except for MIPS, where the only acceptable
10 ifeq ($(findstring mips,$(HOSTARCH)),mips)
11 TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
13 TOOLCHAIN_WRAPPER_HASH_STYLE = both
16 TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
17 TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
19 # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
20 # separate argument when used in execv() by the toolchain wrapper.
21 TOOLCHAIN_WRAPPER_OPTS = \
22 $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
23 TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
25 ifeq ($(BR2_CCACHE),y)
26 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
29 ifeq ($(BR2_x86_x1000),y)
30 TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
33 # Avoid FPU bug on XBurst CPUs
34 ifeq ($(BR2_mips_xburst),y)
35 TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
38 ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
39 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
42 define TOOLCHAIN_WRAPPER_BUILD
43 $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
44 -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
45 toolchain/toolchain-wrapper.c \
46 -o $(@D)/toolchain-wrapper
49 define TOOLCHAIN_WRAPPER_INSTALL
50 $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
51 $(HOST_DIR)/bin/toolchain-wrapper