From: Romain Naour <romain.naour@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 01/18] toolchain-external: move wrapper to toolchain directory
Date: Sat, 3 Oct 2015 20:45:59 +0200 [thread overview]
Message-ID: <56102267.3010808@openwide.fr> (raw)
In-Reply-To: <1442774504-22799-2-git-send-email-arnout@mind.be>
Hi Arnout,
Le 20/09/2015 20:41, Arnout Vandecappelle (Essensium/Mind) a ?crit :
> The toolchain wrapper will be reused for the internal toolchain, so it
> belongs in the toolchain directory. Also, the ext- prefix is removed
> from it. The build commands are moved to a new toolchain-wrapper.mk.
>
> The wrapper arguments that are also relevant for the internal toolchain
> wrapper are moved to toolchain-wrapper.mk, the rest stays in
> toolchain-external.mk.
>
> While we're at it, move the building of the toolchain wrapper to the
> build step of toolchain-external. There is no specific reason to do
> this, other than that it fits better semantically. Also remove the
> MESSAGE call, otherwise we'd see:
>>>> toolchain-external undefined Building
>>>> toolchain-external undefined Building toolchain wrapper
> /usr/bin/gcc ...
> Having an extra "Building toolchain wrapper' message is pointless.
>
> The useless condition on $(BR2_TARGET_OPTIMIZATION) is removed. It was
> always true because it wasn't qstrip'ped first, so clearly it works
> without that condition as well.
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Fabio Porcedda <fabio.porcedda@gmail.com>
> Cc: J?r?me Oufella <jerome.oufella@savoirfairelinux.com>
> ---
> toolchain/toolchain-external/toolchain-external.mk | 55 +++++++---------------
> ...ext-toolchain-wrapper.c => toolchain-wrapper.c} | 0
Maybe you have to change some comments in the source file that refer to the
external toolchain wrapper.
Otherwise, this patch is ok.
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
Best regards,
Romain
> toolchain/toolchain-wrapper.mk | 27 +++++++++++
> 3 files changed, 45 insertions(+), 37 deletions(-)
> rename toolchain/{toolchain-external/ext-toolchain-wrapper.c => toolchain-wrapper.c} (100%)
> create mode 100644 toolchain/toolchain-wrapper.mk
>
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 61a5dba..d60d116 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -153,15 +153,14 @@ TOOLCHAIN_EXTERNAL_CROSS = $(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX
> TOOLCHAIN_EXTERNAL_CC = $(TOOLCHAIN_EXTERNAL_CROSS)gcc
> TOOLCHAIN_EXTERNAL_CXX = $(TOOLCHAIN_EXTERNAL_CROSS)g++
> TOOLCHAIN_EXTERNAL_READELF = $(TOOLCHAIN_EXTERNAL_CROSS)readelf
> -TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
>
> ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),)
> # 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)"'
> else
> # 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)/%=%)"'
> endif
>
> @@ -180,59 +179,54 @@ CC_TARGET_MODE_ := $(call qstrip,$(BR2_GCC_TARGET_MODE))
> # to select the right multilib variant
> ifeq ($(BR2_x86_64),y)
> TOOLCHAIN_EXTERNAL_CFLAGS += -m64
> -TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64
> +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_64
> endif
> ifneq ($(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
> ifneq ($(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
> ifneq ($(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
> ifneq ($(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
> ifneq ($(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
> ifneq ($(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
> ifeq ($(BR2_BINFMT_FLAT),y)
> TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
> -TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT
> +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_BINFMT_FLAT
> endif
> 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
> endif
> 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
> endif
> 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
> endif
> -ifneq ($(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)
> TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
> -TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
> +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
> endif
>
> # The Linaro ARMhf toolchain expects the libraries in
> @@ -686,15 +680,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT
> endef
> 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
> # symlinks for everything else. Skip gdb symlink when we are building our
> # own gdb to prevent two gdb's in output/host/usr/bin.
> @@ -705,8 +690,6 @@ endif
> # match the *cc-* pattern. Therefore, an additional case is added for *-ar,
> # *-ranlib and *-nm.
> 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; \
> for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
> base=$${i##*/}; \
> @@ -715,7 +698,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
> ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
> ;; \
> *cc|*cc-*|*++|*++-*|*cpp) \
> - ln -sf ext-toolchain-wrapper $$base; \
> + ln -sf toolchain-wrapper $$base; \
> ;; \
> *gdb|*gdbtui) \
> if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
> @@ -727,10 +710,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
> ;; \
> esac; \
> 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
>
> # This sed magic is taken from Linux headers_install.sh script.
> @@ -769,6 +748,8 @@ define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
> fi
> endef
>
> +TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER)
> +
> define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
> $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
> $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
> diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
> similarity index 100%
> rename from toolchain/toolchain-external/ext-toolchain-wrapper.c
> rename to toolchain/toolchain-wrapper.c
> diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
> new file mode 100644
> index 0000000..8e8a445
> --- /dev/null
> +++ b/toolchain/toolchain-wrapper.mk
> @@ -0,0 +1,27 @@
> +# 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 external
> +# 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
>
next prev parent reply other threads:[~2015-10-03 18:45 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-20 18:41 [Buildroot] Internal toolchain wrapper & ccache fixes Arnout Vandecappelle
2015-09-20 18:41 ` [Buildroot] [PATCH 01/18] toolchain-external: move wrapper to toolchain directory Arnout Vandecappelle
2015-10-03 18:45 ` Romain Naour [this message]
2015-09-20 18:41 ` [Buildroot] [PATCH 02/18] gcc: use toolchain wrapper Arnout Vandecappelle
2015-10-03 19:42 ` Romain Naour
2015-09-20 18:41 ` [Buildroot] [PATCH 03/18] gcc: remove unsafe patch check (poison system dirs) patch Arnout Vandecappelle
2015-10-03 19:47 ` Romain Naour
2015-09-20 18:41 ` [Buildroot] [PATCH 04/18] infra: move ccache handling to the toolchain wrapper Arnout Vandecappelle
2015-10-03 21:02 ` Romain Naour
2015-09-20 18:41 ` [Buildroot] [PATCH 05/18] perl: Remove ccache handling Arnout Vandecappelle
2015-10-03 21:07 ` Romain Naour
2015-09-20 18:41 ` [Buildroot] [PATCH 06/18] imx-lib: remove now-redundant " Arnout Vandecappelle
2015-10-03 21:11 ` Romain Naour
2015-10-03 21:16 ` Romain Naour
2015-09-20 18:41 ` [Buildroot] [PATCH 07/18] imx-vpu: " Arnout Vandecappelle
2015-10-03 21:22 ` Romain Naour
2015-09-20 18:41 ` [Buildroot] [PATCH 08/18] linux: " Arnout Vandecappelle
2015-10-03 21:23 ` Romain Naour
2015-09-20 19:23 ` [Buildroot] [PATCH 09/18] uboot: " Arnout Vandecappelle
2015-09-20 19:23 ` [Buildroot] [PATCH 10/18] barebox: " Arnout Vandecappelle
2015-10-03 21:25 ` Romain Naour
2015-09-20 19:23 ` [Buildroot] [PATCH 11/18] cryptodev-linux: remove now-redundant fix-ccache-compile patch Arnout Vandecappelle
2015-10-03 21:34 ` Romain Naour
2015-09-20 19:23 ` [Buildroot] [PATCH 12/18] qt5base: remove now-redundant ccache handling Arnout Vandecappelle
2015-10-03 21:43 ` Romain Naour
2015-09-20 19:23 ` [Buildroot] [PATCH 13/18] package-cmake: remove now-redundant target ccache support Arnout Vandecappelle
2015-10-04 9:32 ` Romain Naour
2015-10-03 21:24 ` [Buildroot] [PATCH 09/18] uboot: remove now-redundant ccache handling Romain Naour
2015-09-20 19:28 ` [Buildroot] [PATCH 14/19] package-cmake: remove now-redundant target ccache support Arnout Vandecappelle
2015-09-20 19:28 ` [Buildroot] [PATCH 15/19] qpid-proton: remove now-redundant ccache handling patch Arnout Vandecappelle
2015-10-04 9:44 ` Romain Naour
2015-09-20 19:28 ` [Buildroot] [PATCH 16/19] Makefile.in: remove now-unused TARGET_CC/CXX_NOCCACHE Arnout Vandecappelle
2015-10-04 9:48 ` Romain Naour
2015-09-20 19:28 ` [Buildroot] [PATCH 17/19] [RFC] toolchain-wrapper: support change of BR2_CCACHE Arnout Vandecappelle
2015-10-04 10:13 ` Romain Naour
2015-09-20 19:28 ` [Buildroot] [PATCH 18/19] ccache: use mtime for external toolchain, CONF_OPTS for internal toolchain Arnout Vandecappelle
2015-09-21 21:43 ` Samuel Martin
2015-09-21 22:32 ` Arnout Vandecappelle
2015-09-22 19:25 ` Samuel Martin
2015-09-20 19:28 ` [Buildroot] [PATCH 19/19] [RFC] ccache: support changing the output directory Arnout Vandecappelle
2015-09-20 19:32 ` [Buildroot] [PATCH 14/19] package-cmake: remove now-redundant target ccache support Arnout Vandecappelle
2015-10-03 21:49 ` Romain Naour
2015-09-21 21:43 ` [Buildroot] Internal toolchain wrapper & ccache fixes Samuel Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56102267.3010808@openwide.fr \
--to=romain.naour@openwide.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.