diff options
Diffstat (limited to 'toolchain/toolchain-wrapper.mk')
-rw-r--r-- | toolchain/toolchain-wrapper.mk | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk new file mode 100644 index 0000000000..899947de77 --- /dev/null +++ b/toolchain/toolchain-wrapper.mk @@ -0,0 +1,26 @@ +# This file contains the definition of the toolchain wrapper build commands + +# 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_WRAPPER_HASH_STYLE = sysv +else +TOOLCHAIN_WRAPPER_HASH_STYLE = both +endif + +TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) +TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' + +# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a +# separate argument when used in execv() by the toolchain wrapper. +TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)' + +# For simplicity, build directly into the install location +define TOOLCHAIN_BUILD_WRAPPER + $(Q)mkdir -p $(HOST_DIR)/usr/bin + $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ + -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ + toolchain/toolchain-wrapper.c \ + -o $(HOST_DIR)/usr/bin/toolchain-wrapper +endef |