2015-10-04 14:28:41 +02:00
|
|
|
# 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: fix potential bug in foreach loop
In Makefile, the comma ',' is used to separate the arguments passed to
functions, so we should not be allowed to use straight commas in strings
we want to expand.
For the toolchain wrapper, we need to transform a list:
-mfoo -mbar -mbuz
into something acceptable for a C array assignment:
"-mfoo", "-mbar", "-mbuz",
So, we use a $(foreach ...) loop for that. However, we do have a
straight comma in there.
It does not cause any issue in practice, since $(foreach) is a make
builtin function that accepts three and only three parameters.
However, this is not sane.
Change the straight comma to the usual $(comma) expansion, like we would
do for a call to any other function.
At the same time, make the code a bit easier to read, by first creating
the transformed list, and then creating the define.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-10-21 23:21:07 +02:00
|
|
|
TOOLCHAIN_WRAPPER_OPTS = \
|
|
|
|
$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
|
2015-10-04 14:28:41 +02:00
|
|
|
|
2015-10-04 17:23:56 +02:00
|
|
|
ifeq ($(BR2_CCACHE),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
|
|
|
|
endif
|
|
|
|
|
2015-10-19 13:02:52 +02:00
|
|
|
ifeq ($(BR2_x86_x1000),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
|
|
|
|
endif
|
|
|
|
|
2016-11-09 17:16:57 +01:00
|
|
|
# Avoid FPU bug on XBurst CPUs
|
|
|
|
ifeq ($(BR2_mips_xburst),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
|
|
|
|
endif
|
|
|
|
|
2015-10-04 17:25:32 +02:00
|
|
|
ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
|
|
|
|
endif
|
|
|
|
|
2016-09-28 10:00:56 +02:00
|
|
|
define TOOLCHAIN_WRAPPER_BUILD
|
2015-10-04 14:28:41 +02:00
|
|
|
$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
|
|
|
|
-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
|
|
|
|
toolchain/toolchain-wrapper.c \
|
2016-09-28 10:00:56 +02:00
|
|
|
-o $(@D)/toolchain-wrapper
|
|
|
|
endef
|
|
|
|
|
|
|
|
define TOOLCHAIN_WRAPPER_INSTALL
|
|
|
|
$(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
|
2017-07-05 13:14:19 +02:00
|
|
|
$(HOST_DIR)/bin/toolchain-wrapper
|
2015-10-04 14:28:41 +02:00
|
|
|
endef
|